To my understanding when I
and the 'input' is a long string with spaces inbetween, ieCode:cin >> input
Only "Hello" will be stored in 'input' because of the white spaces. How do I get the entire string in 'input'?Code:"Hello out there."
To my understanding when I
and the 'input' is a long string with spaces inbetween, ieCode:cin >> input
Only "Hello" will be stored in 'input' because of the white spaces. How do I get the entire string in 'input'?Code:"Hello out there."
getline
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
Note that if you use cin >> to read in integers or any other values and then use getline to read in the string, you will probably end up reading in an empty line. Make sure to add a cin.ignore() after calls to cin >> to ignore the newline that will stop getline from getting any data.
Last edited by Daved; 05-07-2007 at 03:30 PM.
Thanks! I was just about to ask about that.