Repetition Statements in C++
C++ provides three types of repetition statements (also called looping statements or loops) for performing statements repeatedly while a condition (called the loop-continuation condition) remains true. These are the while, do...while and for statements. (Chapter 5 presents the
for statements, and Chapter 7 presents a specialized version of the
for statement that’s used with arrays and containers.) The
for statements perform the action (or group of actions) in their bodies zero or more times—if the loop-continuation condition is initially false, the action (or group of actions) will not execute. The
while statement performs the action (or group of actions) in its body at least once.