Offistart - Virtual Offices, Office Space, Business Support Services
*Home>>>Telephone Answering

C++ using if else statement question?


I have tried to work out this program about 15 times and I keep getting the wrong answer

Using if statements to write a C++ program that inputs a single letter and prints out the corresponding digit on the telephone. The letters and digits on a telephone are grouped this way;

2 = ABC, 3= DEF, 4= GHI, 5= JKL, 6= MNO, 7= PRS, 8= TUV, 9= WXY

No digit corresponds to either Q or Z. For these 2 letters your program should print a message indicating that they are not used on a telephone.


I have tried doing my own program but when I type in a letter other than A B or C, such at D, I get an answer of 2, which is not right, it should print out 3.

Any help would be greatly appreciated!!!! THANK YOU!

char letter;

cout << "Enter a number";
cin >> a;

cout << "The letter is on key "
if(letter == 'a' || letter =='b' || letter =='c')
cout << "2" << endl;
else if(letter == 'd' || letter == 'e' || letter == 'f')
cout << "3" << endl;
else if(letter == 'g' || letter == 'h' || letter == 'i')
cout << "4" <<endl;

and so on....

for those that don't know...

and I made a typo, it's supposed to be:
cin >> letter;
sorry, I went back to change it so it wasn't a=='a' || a =='b' and missed one. Report It

in the if statement u can use the OR condition for eg. if(char==q||char==z){cout<<"these leters are not used on a telefone";} where char is the letter entered by the user....
there are other possibilities too...

no

Tags
  Business Services   Business Address   Call Forwarding   Call Handling   Answering Service   Telephone Answering   Mail Forwarding   Virtual Address   Virtual Assistant   Virtual Business   Virtual Offices
Related information
  • Help me to setup EPABX(intercom) or please contact me any EPABX technician from kolkata to my cell-9830908864.

    Hi, You can search the google for epabx or search at www.justdial.com, you will find the dealer of Creative Telecom, New Delhi. Or if you not satisfy with product or service, log on to www.cent...

  • Landline phone through pc not using voip, but regular phone service?

    I do know that you cant hook up your telephone to your PC because they dont use the same type of data, it would be inaudible like your modem ticking and beeping when you sign onto the internet. The...

  • For the breeders: Female dog ate chocolate -had mild symptoms-let puppies nurse?

    Yes it can make the pups heart rate go up to high and cause them to get agitated. If she is still feeling the symptoms of the chocolate than maybe she should be seen by your vet. She should not h...

  • In the UK is there anywhere online I can find a persons address by MOBILE phone number?

    No. If they are dodgy report them to trading standards or the Police and let them use their resources.

    ...
  • Does anybody find this as funny as i did?

    My husband will have a good laugh, he loves mean fun too. Now he won't beat me for being on here all day. JUST JO-SHIN. Thanx for the funny.

    ...
  • Phones in Church?

    Excellent, I loved it, the cat didn't, spashed coffee on him laughing!

    ...
  • What method would you use to search for a new home?

    In the following order: 1. Internet 2. Contact an agent 3. Drive around, looking 4. Look in a newspaper. I am male, 57 yrs old.

    ...
  • Who to chose an attorney for Wrongful Termination?

    Reformat your question in a succinct manner, provide a link if you wish - no one is going to read a rant or verbose paste. That's absurd.

    ...
  •  

    Categories--Copyright/IP Policy--Contact Webmaster