switch (integer-producing expression) { case integer constant 1: statements for integer 1 break; case integer constant 2: statements for integer 2 break; ... default: default statements }
switch
statements, you may omit the symbol
default:
and the default statements.
switch
statements,
the integer-producing expression can produce a value belonging to any of
the integral data types, including the char
data type.
switch
statements, once embedded statement execution begins,
execution continues up to the first embedded break
statement or
to the end of the switch
statement, whichever comes first.
Bugs emerge when you forget to pair case
symbols with break
statements.
cerr
as the target of an output statement, rather than
cout
.
#include... exit (0);