Sometimes it is useful to have a collection of values of different types and to treat the collection as a single item
For example, consider a bank certificate of deposit, which is often called a CD
A CD is a bank account that does not allow withdrawals for a specified number of months
A CD naturally has three [...]
Suppose you create a screen menu that asks the user to select one of five choices—for example
Cheap
Moderate
Expensive
Extravagant
Excessive
You can extend an if else if else sequence to handle five alternatives
But the C++ switch statement more easily handles selecting a choice from an extended list
Here’s the general form for a switch statement (A-1):
Example of (A-1)
switch (integer-expression)
{
case [...]