Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can sombody please write me a C++ program that reads the letter codes of a telep

ID: 673290 • Letter: C

Question

Can sombody please write me a C++ program that reads the letter codes of a telephone number pad and converts them into numbers. Please only use if else statements, or switch case statements, or while loops. Please do not use arrays or anything too advanced because we have not gotten very far in the course. The user should be prompted for a 10 letter or number sequence. Leave the numbers as they are and convert the letters only. Only allow 10 digit strings to be entered. Thank you in advance!

1

2: ABC

3: DEF

4: GHI

5: JKL

6: MNO

7: PQRS

8: TUV

9: WXYZ

1

2: ABC

3: DEF

4: GHI

5: JKL

6: MNO

7: PQRS

8: TUV

9: WXYZ

Explanation / Answer

#include<iostream>
using namespace std;
main()
{
  
  
   cout<<"Enter your ten letter sequence: ";
   char c[10];
   for(int i=1;i<11;i++)
   cin>>c[i];
   cout<<" Coressponding number sequence is: ";
   for(int i=1;i<11;i++)
   {  
if(c[i]=='A'||c[i]=='B'||c[i]=='C')
cout<<"2";
else if(c[i]=='D'||c[i]=='E'||c[i]=='F')
cout<<"3";
else if(c[i]=='G'||c[i]=='H'||c[i]=='I')
cout<<"4";
else if(c[i]=='J'||c[i]=='K'||c[i]=='L')
cout<<"5";
else if(c[i]=='M'||c[i]=='N'||c[i]=='O')
cout<<"6";
else if(c[i]=='P'||c[i]=='Q'||c[i]=='R'||c[i]=='S')
cout<<"7";
else if(c[i]=='T'||c[i]=='U'||c[i]=='V')
cout<<"8";
else if(c[i]=='W'||c[i]=='X'||c[i]=='Y'||c[i]=='Z')
cout<<"9";
else
cout<<c[i]<<" is an invalid input";
   }  
}