-----
tomorrow's lab quiz:
* ask you to declare C++ named constant
* design recipe steps for a simple C++ function
* given a function containing an if/if-else-if pattern,
and given an expression calling that function,
you could give the value of that expression
-----
* another C++ conditional/branching statement:
switch
is a multi-way branch (choose 1 from 3 or more)
that can be compiled very efficiently
BUT is limited in the types of data allowed;
switch(int_or_char_or_integer_based_expr)
{
case value1:
statement;
...
break;
case value2:
statement;
...
break;
...
default:
statement;
...
}
* semantics:
* the switch's expression is evaluated
* the result is compared to value after
of each of the cases until you find
one that matches
...you then start doing that case's
statements, until you hit a break
or the end of the switch
* if the switch's expression
matches NONE of the cases' expressions,
do the default's statements
(if there is a default);
(else, just fall out of the
statement)