Chapter 5. Building Iteration Loops

<feature>
  • Learn why loops are important for repetitive tasks

  • Learn how to use C++ iteration statements

  • Understand the concepts behind loop design

  • Understand the flow of controln in iteratio

  • Discover how you can fine-tune your loops

</feature>

Why Use Loops?

Many programming tasks are repetitive, having little variation from one item to the next. The process of performing the same task over and over again is called iteration, and C++ provides built-in iteration functionality. A loop executes the same section of program code over and over again, as long as a loop condition of some sort is met with each iteration. This section of code can be a single statement or a block of statements (a compound statement). Now that ...

Get Practical C++ 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.