We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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:
Arrays Introduction
You are viewing a single comment's thread. Return to all comments →
The firts while loop finishes when
cin
reads EOF, i.e. whencin
finishes to read the whole input stream.Another way is using
scanf
from C, it returns the number of input data assigned or the definedmacro 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.