Hour 6. Controlling the Flow of a Program

Looping

One of the things that a computer excels at is doing the same thing over and over again. Software doesn’t get tired.

Many programming tasks are accomplished by doing the same thing either a fixed number of times or until a specific condition is met. A block of code that’s executed more than once in a row in a program is called a loop. Each pass through the loop is called an iteration.

These terms will come in handy as you learn during this hour about while loops, do-while loops, and for loops.

while Loops

A while loop causes a program to repeat ...

Get Sams Teach Yourself C++ in 24 Hours, fifth edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.