Electrical
and Computer Engineering
More on End-of-File Loops
•Keep in mind that the input stream can fail even though we haven’t reached the end of the file.
•EOF-controlled loops
are similar to sentinel-controlled
loops in that the program doesn’t know in
advance how many data items are to be
input.
•It is possible to use an EOF-controlled loop when we read from the standard input device via the cin stream instead of a data file.