Skip to main content

AD

The following program reads the letter from A to Z and prints it's corresponding telephone digit. This program uses a sentinal controlled while loop . To stop the program user is promoted for the sentinal which is # .

 The following program reads the letter from A to Z and prints it's corresponding telephone digit. This program uses a sentinal controlled while loop . To stop the program user is promoted for the sentinal which is # .


SOURCE  CODE :-

#include <iostream> 
using namespace std; 
int main() 
char letter ;
cout << "This is a program to convert uppercase Letter from A to Z into their corresponding telephone digit " << endl ;
cout << "To stop this program enter # " << endl ;
cout << "Enter an uppercase letter : " << endl ;
cin >> letter ;
while (letter != '#' )
{
cout << "The letter you entered is " << letter << " and the corresponding telephone digit is : " << endl ;
if (letter >= 'A' && letter <= 'Z' )
{
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 ;
break ;
}
}
else
cout << "Invalid input "<< endl ;
cout << "Enter another uppercase letter to find it's corresponding telephone digit, To stop the program please enter '#' " << endl ;
cin >> letter ;
cout << endl ;
}
return 0 ;
}

Follow us for more posts like this ........

Comments

Popular posts from this blog

Different Species of Cheetahs Present in the World

  Different Species of C heetah Present in the World :- There is only one species of cheetah, which is called Acinonyx jubatus. Cheetahs are found in various parts of Africa, as well as in a small population in Iran. There are several subspecies of cheetah, including: Acinonyx J ubatus V enaticus : -   Acinonyx jubatus venaticus, also known as the Asiatic cheetah, is a subspecies of cheetah found in Central Asia and the Transcaucasus region. It is the only remaining population of cheetahs in Asia, and is critically endangered with fewer than 50 individuals remaining in the wild. The Asiatic cheetah is adapted to living in arid and semi-arid environments, and is found in grasslands, savannas, and steppes. It is slightly smaller in size compared to other subspecies of cheetah, and has a longer and thicker coat to help it survive in colder climates. The Asiatic cheetah is threatened by habitat loss, poaching, and conflict with humans. Conservation efforts are underway to ...

How to download any movie from website for free

 Assalam u Alaikum ! I hope all of you are fine and enjoying your life happily . You are reading TN WRITES . In today post I am going to tell you how you can download any movie using filmymeet website which is a free website . Here is Step by Step process :- 1)- Open your Google Chrome or any other browser which you use in your daily life .....  Currently , I am using Google Chrome browser ... 2)-Search in search bar  "Filmymeet"  3)-Open first website .... "Filmymeet"  If you can't find this website than don't worry just click on the following name of website Filmymeet You will directly goes to the home page of website . 4)-Here is the homepage of filmymeet  5)-If you get your movie on homepage it's good but if you don't get your required movie than just scroll down and find search bar which is nearly at the bottom of page ..... And search your desired movie with it's correct name  For example , If I want to download IRON MAN Movie than I have t...

1st Year Chemistry Short Questions (Chapter 10)

 If you are in 1st year class And searching for important short questions for your exams preparation than read it out  Here is some short questions from chapter 10 of 1st year INTRODUCTION   1. Define electrochemistry? 2. Differentiate oxidation & réduction  3. Explain the difference b/w electrolytic cell & voltic cell,  OXIDATION STATE  4. Write four rules used to assign oxidation state of element. 5. What is oxidation no. of hydrogen & oxygen in their compounds? 6. Calculate oxidation no. of Cl in Ca(CIO3)2, NaCI, KCI & KClO3 7. Calculate oxidation no. of Cr in Cr2(SO4)3& Cr2O7^-2 8. What is oxidation no.? Determine Oxidation No. of P in H3PO4 9. Calculate the oxidation no. of S in SO4^2-& Mn in KMnO4  ELECTROLYTIC CONDUCTION & ELECTROLYTIC CELL   10. What is difference b/w metallic and electrolytic conduction?  11. Define electrolysis and ionization. 12. Describe the electrolysis of molten sodium chloride. ...