This code isn't using strlen. That's a function for c-strings but your code uses C++ std::string. The correct header for std::string is #include <string>
Note that there is an example of a do-while loop given on the above reference page for strcmp, which may be similar to what you want. It repeats until the user enters "apple".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
#include <cstring>
usingnamespace std;
int main()
{
char stuff[50];
cout << "Please Enter something: " ;
cin >> stuff;
if (strcmp(stuff,"stop") == 0)
cout << "\nstuff is equal to 'stop'\n";
else
cout << "\nThe number of characters entered was " << strlen(stuff) << '\n';
}