C++ Declare string with a given size

In this post, we will discuss how to declare string with given size. Syntax to declare string of given size string s(N, X); The above line of code declares a string of size N filled with character X. For example, Output