Page 51 - Modular_V2.0_C++_Flikpbook
P. 51

Program 6: To check whether the entered character is vowel or consonant.

                 #include<iostream.h>
                 #include<conio.h>

                 void main()
                 {
                     clrscr();
                     char ch;

                     cout<<"Enter a character: ";
                     cin>>ch;
                     switch (ch)
                     {

                     case 'A':
                         cout<<"Entered character is vowel";
                     break;
                     case 'a':

                         cout<<"Entered character is vowel";
                     break;
                     case 'E':
                         cout<<"Entered character is vowel";

                     break;
                     case 'e':
                         cout<<"Entered character is vowel";
                     break;

                     case 'I':
                         cout<<"Entered character is vowel";
                     break;
                     case 'i':

                         cout<<"Entered character is vowel";
                     break;
                     case 'O':
                         cout<<"Entered character is vowel";

                     break;
                     case 'o':
                         cout<<"Entered character is vowel";
                     break;

                     case 'U':
                         cout<<"Entered character is vowel";
                     break;

                                                                                                                  49
                                                                                           Conditional Statements
   46   47   48   49   50   51   52   53   54   55   56