I would also declar the global: usingnamespace std; after the preprocessor directives at the top... But, that's your perogative.
Here is a better way:
psuedo code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string name = "";
cout<< "Enter your name: ";
cout.flush();
cin>> name;
cout<< endl<< endl;
cout<< "The length of your name is "<< name.size()<< "."<< endl;
return 0;
}
just one more question....
when I type "Hello World" the length comes back as '5' is there a way to handle spaces, or are they counted as part of a character...