Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Python program to convert telephone number letters to digits Dialpad mapping DIALPAD 1 1 2 ABC 3 DEF ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

How should Kane work with the salespeople to introduce the change?

Answered: 1 week ago