• Counter-controlled repetition requires a control variable, the initial value of the control variable, the increment (or decrement) by which the control variable is modified each time through the loop and the loop-continuation condition that determines whether looping should continue.
• The for header “does it all”—it specifies each of the items needed for counter-controlled repetition with a control variable. The general format of the
for statement is
for ( initialization; loopContinuationCondition; increment ) statement
where the initialization expression names the loop’s control variable and provides its initial value, the loopContinuationCondition ...