Stream Input
A loop that would read values repeatedlyfrom the input until end of file could be written as:
while (cin >> intval) { // process intval ...}// reach this point on end of input...
An easy way to remember, the stream I/O operations is to visualize them as arrows.
The input operator, >> x, points data into x, whilethe output operator, << x, copies data out of x.