I still don't understand how it knows to stop at the end of one line during one loop cycle and then pick up from there and get the next line during the next cycle.
Because the end of line character is a whitespace character, and by default the C++ input stream ignores whitespace. See these links: operator>> and the skipws manipulator.
Also you need to realize that to C/C++ there is little if any difference between operating on the console or operating on a file.
This post has been edited by jimblumberg: 19 February 2013 - 01:24 PM