int number; string text; cin>>number; // Here I read "1234aaaa" cin>>text; cout<<number<<" "<<text; // It prints "1234 aaaa"
I understand that the stream stores
aaaa from the previous reading and then it passes it to the next reading.
How can I avoid the garbage value from
number to be passed to
if you want to flush all the rest of the line after the number you can use