Hello everyone, how to clear the input "cin" buffer in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello everyone, how to clear the input "cin" buffer in C++?

22nd Oct 2020, 12:21 PM
Aleksey Elshin
Aleksey Elshin - avatar
5 Answers
+ 2
while(cin.get() != EOF);
22nd Oct 2020, 12:39 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
and how to add the next input, you need to clean the first input from unnecessary input data so that when outputting subsequent ones, these unnecessary ones are not written. but at the same time I want to enter new values ​​and display them already
22nd Oct 2020, 12:50 PM
Aleksey Elshin
Aleksey Elshin - avatar
0
Can you give me some sample inputs, so I can know what's necessary and what's not.
22nd Oct 2020, 12:57 PM
你知道規則,我也是
你知道規則,我也是 - avatar
22nd Oct 2020, 12:59 PM
Aleksey Elshin
Aleksey Elshin - avatar
0
Input: 1 2 3 4 5 Cout<<1<<2 Input: 3 89 3 Cout<<3<<89
22nd Oct 2020, 1:02 PM
Aleksey Elshin
Aleksey Elshin - avatar