Question: To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can

To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 225-5466 can be displayed as CALL HOME, which uses eight letters. Write a program that prompts the user to enter a telephone number expressed in letters and outputs the corresponding telephone number in digits. If the user enters more than seven letters, then process only the first seven letters. Also output the - (hyphen) after the third digit. Allow the user to use both uppercase and lowercase letters as well as spaces between words. Moreover, your program should process as many telephone numbers as the user wants

This is what i have: what do i need to do to make it display the whole number

#include "stdafx.h"

#include

using namespace std;

int main()

{

char letter;

cout << "Program to prompt the user to enter a telephone number expressed in letters"

<< endl;

cout << "To stop the program enter #."

<< endl;

cout << "Enter a telephone number expressed in Uppercase letters: ";

cin >> letter;

cout << endl;

while (letter != '#')

{

cout << "The telephone you entered is: "

<< letter << endl;

cout << "The corresponding telephone "

<< "digit is: ";

switch (letter)

{

case 'A':

case 'B':

case 'C':

cout << "2" << endl;

break;

case 'D':

case 'E':

case 'F':

cout << "3" << endl;

break;

case 'G':

case 'H':

case 'I':

cout << "4" << endl;

break;

case 'J':

case 'K':

case 'L':

cout << "5" << endl;

break;

case 'M':

case 'N':

case 'O':

cout << "6" << endl;

break;

case 'P':

case 'Q':

case 'R':

case 'S':

cout << "7" << endl;

break;

case 'T':

case 'U':

case 'V':

cout << "8" << endl;

break;

case 'W':

case 'X':

case 'Y':

case 'Z':

cout << "9" << endl;

default:

cout << "Invalid input." << endl;

}

return 0;

}

}

Step by Step Solution

3.45 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python program to convert telephone number letters to digits Dialpad mapping DIALPAD 1 1 2 ABC 3 DEF ... View full answer

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 Programming Questions!