SyntaxFix
Write A Post
Hire A Developer
Questions
If you really, really want to use strlen(), then
cout << strlen(str.c_str()) << endl;
else the use of .length() is more in keeping with C++.