#include#include using namespace std; int main() { string str = "Hello World!"; cout << "The size of the string is: " << str.size() << endl; return 0; }
#includeThis code creates a character array `str` containing the text "Hello World!", and then uses the `strlen()` function from the C Standard Library to find the length of the string. Package/library: C Standard Library#include using namespace std; int main() { char str[] = "Hello World!"; int len = strlen(str); cout << "The size of the string is: " << len << endl; return 0; }