Hey guys,
I encountered a problem with my codes.
I am trying to...
1. Receive the entire user input, including spaces and blanks, for example if the input was "Hello World" if I use a cin >> I will only get "Hello"
I'm trying to figure out how to get the entire thing
2. I am attempting on the int len = myString.length(); but I'm always getting a 0
what am I doing wrong?
string myString, junk;
cout << "insert string variable" << endl;
cin >> myString;
int numone = myString.length(); //length function
cout << myString; //seeing the user input
getline (cin, junk,'\n'); //this is where I am trying to erase
getline (cin, myString, '\n'); //the space between to get the entire
getline (cin,myString); //user input
cout << myString << endl; //testing
cout << junk << endl;
cout << numone; //testing for the length