Question: Write a C++ program that converts letters of the alphabet into their corresponding digits on the telephone. The program should let the user enter letters

Write 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 : M

The letter M corresponds to 6 on the telephone.

Enter a letter : S

The letter S corresponds to 7 on the telephone.

Enter a letter : O

The letter O corresponds to 6 on the telephone.

Enter a letter : 2

Invalid letter. Enter Q or Z to quit.

Enter a letter : Q

Quit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!