When I write a program, and use the -
cout << "A:";
cin >> string_var;
cout << "B";
cin >> string_var2;
If there is a space in between the two inputs on the keyboard (for ex. If the console displayed:
A:_ (waiting for input) and I typed a a
, the first a
would go to the string_var
and the second would go to string_var2
. How can I flush the input stream?