I need to count the numbers to the end of the line, I implemented it with cin.peek ():
int a; while(cin.peek() != '\n') { cin >> a; // some pieces of code } But a problem arose: while the lines by type 1 2 3 this code processes correctly, for the same line, but with a space at the end, the program continues. Tell me, please, why such a problem arises, and how to solve it?