+ 8
why does the string not equal to the inputted string value?
basic overview of my code: cin>>userinput // i input "hi there" cout<<userinput //outputs hi, not hi there?
3 ответов
+ 8
because cin reads the string until it reads a space
use getline(cin, userinput) to read the whole line
+ 5
cin ends at whitespace you will need to use getline instead.
+ 5
getline(cin,strUserInput);
cout << strUserInput;