You are viewing a single comment's thread. Return to all comments →
The firts while loop finishes when cin reads EOF, i.e. when cin finishes to read the whole input stream.
Another way is using scanf from C, it returns the number of input data assigned or the defined macro EOF (-1) when there is nothing less to read, so you can do the next one:
Those are the way of reading in c++ the whole input, there is challenges where the input size is not given
Sorry my english.