Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions The program Telephone Digits outputs only telephone digits that correspond to uppercase letters. Rewrite the program so that it processes both uppercase and
Instructions The program Telephone Digits outputs only telephone digits that correspond to uppercase letters. Rewrite the program so that it processes both uppercase and lowercase letters and outputs the corresponding telephone digit. If the input is something other than an uppercase or lowercase letter, the program must output an appropriate error message (The error message should contain the phrase Invalid input). ****// I 2 // Program: Telephone Digits 3 // This is an example of a sentinel-controlled loop. This 4 // program converts uppercase letters to their corresponding 5 // telephone digits. 6 //***** 7 #include 8 9 using namespace std; 10 11 int main() 12 { 13 14 15 16 17 34 FREE 18 19 20 21 22 23 24 25 char letter; int digit, num; cout < < "Program to convert uppercase letters to < < "their corresponding telephone digits." < < endl; cout < < "To stop the program enter #." < < endl; cout < > letter; cout < < endl; 11 26 27 28 283 29 30 31 32 33 34 35 36 37 38 39 40 1 Q 43 44 45 46 47 48 49 42 46 while (letter != '#') { cout < < "Letter: " < < letter; cout < < ", Corresponding telephone digit: "; num = static_cast (letter) static_cast ('A'); if (0 50 51 52 53 54 55 56 -57 58 59 60 61 62 } cout < > letter; cout < < endl; } //end while return 0;
Step by Step Solution
★★★★★
3.50 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
You can modify the program to handle both uppercase and lowercase letters and output the correspondi...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started