I just found a comment in this answer saying that using
iostream::eof in a loop condition is "almost certainly wrong". I generally use something like
while(cin>>n) – which I guess implicitly checks for EOF.
Why is checking for eof explicitly using
while (!cin.eof()) wrong?
How is it different from using
scanf("...",...)!=EOF in C (which I often use with no problems)?