Some programs need to contain loops. They are a practical way to make
the program repeat some instruction a large number of times.
The number of times that the instruction has to be repeated could be
known at the time the program is written. Example:
/* Write exactly 1000 things. */
for (int i=1; i<=1000; i++) cout << i << "." << endl ;
In other cases, the number of times an instruction has to be repeated
could be unknown at the time the program is written. Example:
/* Read words until there are no more. */
#include <string>
string theString ;
while (cin >> theString) cout << theString.length() << endl;