To make telephone numbers easier to remember, some companies use letters to show their telephone number. For
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 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;
}
}
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill