O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, fifth edition by Rogers Cadenhead, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required