Storing A sentence in a string variable
Mar 10, 2011 at 8:10pm
I tried to store a sentence as a string by using:
1 2
|
string message;
cin >> message;
|
but that will only keep the first word, what is the best way to make it so that a whole sentence will end up in a string variable? Thanks
Mar 10, 2011 at 8:13pm
>> skips whitespace. Use getline instead:
getline(cin, message);
Topic archived. No new replies allowed.