* reminder:
our first imperative looping statement in C++
* the basic while statement/while loop
while ( bool_expr ) <-- this bool_expr can be said
{ to be controlling the loop
statement1;
statement2; the { } or statement after
... the while is called the
statement_n; BODY of the loop
}
* hopefully you drew the flowchart from the
white board! That's the clearest way
to see the while semantics, I think;
* trying to say it in natural language/prose:
1. evaluate the bool_expr
2. if it is true, do the statements
in the loop's body
...then go back to step 1
if it is false, you're done --
continue AFTER the loop's body
* note that C++'s while loop is a LEADING
DECISION loop -- you make the decision
to continue at the beginning of the loop,
AND, if the bool_expr is FALSE at the beginning,
you NEVER enter the loop body!
* and typically (!) there is at least one
local variable IN that bool_expr,
and if that local variable helps to determine
when that bool_expr is false,
it is often called a LOOP CONTROL variable
* we gave a first example IN lab --
function cheer -- let's develop that properly,
now;
*******************************
* PLEEEEEEEEEEZ make sure SOMETHING in the
BODY of your loop will EVENTUALLY make
the loop's bool_expr false!!!!!!!!!!!!!!!!!!!!!!!!!
DO NOT DO DELIBERATE INFINITE LOOPS on nrs-labs!!!!
*******************************
* CLASSIC loop issues:
* infinite looping!
* never entering the loop (when you meant to)
* going ONE TOO MANY times
* going ONE TOO FEW times