You are on page 1of 4

Imagine you are writing a program for children.

If a child enters the

letter ‘a’, your program should display “A is for Apple”. If a child

enters ‘z’, it should print “Z is for Zebra”.

Sol:

#include<iostream>

using namespace std;

int main()

char alph;

cout<<"Enter any Alphabet: ";

cin>>alph;

switch (alph)

case 'a':

cout<<"A for Apple";

break;

case 'b':

cout<<"B for Ball";

break;

case 'c':

cout<<"C for Cat";

break;

case 'd':

cout<<"D for Dog";

break;

case 'e':

cout<<"E for Elephant";


break;

case 'f':

cout<<"F for Frog";

break;

case 'g':

cout<<"G for Goat";

break;

case 'h':

cout<<"H for Hat";

break;

case 'i':

cout<<"I for Idea";

break;

case 'j':

cout<<"J for Jug";

break;

case 'k':

cout<<"K for kite";

break;

case 'l':

cout<<"L for Leaf";

break;

case 'm':

cout<<"M for Money";

break;

case 'N':

cout<<"N for Nature";

break;

case 'o':
cout<<"O for Orange";

break;

case 'p':

cout<<"P for Pig";

break;

case 'q':

cout<<"Q for Queen";

break;

case 'r':

cout<<"R for Rest";

break;

case 's':

cout<<"S for Sad";

break;

case 't':

cout<<"T for Teen";

break;

case 'u':

cout<<"U for Umbrella";

break;

case 'v':

cout<<"V for Van";

break;

case 'w':

cout<<"W for Watch";

break;

case 'x':

cout<<"X for X-Ray";

break;
case 'y':

cout<<"Y for Yacht";

break;

case 'z':

cout<<"Z for Zebra";

cout<<"\n";

You might also like