Home Segments Index Top Previous Next

564: Mainline

Reexamine the version of the analyze_trades program shown in Segment 556. To convert that program into one that does periodic updates, you need only to put the reading and displaying statements in a special kind of while statement. To repeat a series of statements ad infinitum, you can insert them into a while loop in which the Boolean expression consists of just the number 1. Because 1 is not 0, the while loop will carry on until you type the control-c keychord—or the appropriate alternative recognized by your operating system:

while (1) { 
  ... 
}