The names are stored in the input file first name first, then middle name, then last name, separated by an arbitrary number of blanks. There is only one name per line. The first name or the middle name could be just an initial, or there may not be a middle name.
4. Write a top-down design and a C++ program that converts letters of the alphabet into their corresponding digits on the telephone. The program should let the user enter letters repeatedly until a Q or a Z is entered. (Q and Z are the two letters that are not on the telephone.) An error message should be printed for any nonalphabetic character that is entered.
The letters and digits on the telephone have the following correspondence.
ABC = 2
DEF = 3
GHI = 4
JKL = 5
MNO = 6
PRS = 7
TUV = 8
WXY = 9
Here is an example:
Enter a letter: P
The letter P corresponds to 7 on the telephone.
Enter a letter: A
The letter A corresponds to 2 on the telephone.
Enter a letter: D
The letter D corresponds to 3 on the telephone.
Enter a letter: 2
Invalid letter. Enter Q or Z to quit.
Enter a letter: Z
Quit.
Case Study Follow-Up
1. Rewrite the IncrementProperCounter function in the Rich Uncle case study by eliminating the Switch statement and continuing with the main If-Then-Else-If structure.
2. Rewrite the GetYesOrNo and GetOneAmount functions in the Monthly Rainfall Averages case study, replacing the Do-While loops with While loops.