Next: Multiple Choice Questions
Up: The while statement
Previous: Example Program: Iterative evaluation
while
statement in C++ allows the body of a loop to be
executed repeatedly until a condition is not satisfied. For as long
as the condition is true the loop body is executed.while
statement is the most fundamental of the iteration
statements. Because the condition is tested before executing the loop
statement the loop statement may be executed zero or more times.while
statement requires initialisation of any variables in
the condition prior to entering the while
statement . The loop
statement must include statements to update at least one of the
variables that occurs in the loop condition.