Related Posts Plugin for WordPress, Blogger...

About

Follow Us

Monday, 16 February 2015

Introduction:

In this article I will explain how to check the character you entered is Vowel or Consonant using If-else Ladder in C++.
A,E,I,O,U is known as Vowel and other alphabets are called Consonants.
#include<conio.h>
#include<iostream.h>
main()
{
       char ch;


      cout<<"Enter  any character between a to z : ";
      cin>>ch;
                      if(ch=='a')
                            {
                            cout<<ch<<" is vowel";
                            }
                      else if(ch=='e')
                            {
                            cout<<ch<<" is vowel";
                            }
                      else if(ch=='i')
                            {
                            cout<<ch<<" is vowel";
                            }
                      else if(ch=='o')
                            {
                            cout<<ch<<" is vowel";
                            }
                        else if(ch=='u')
                            {
                                cout<<ch<<" is vowel";
                            }                                
                    else
                           {
                            cout<<ch<<" is  consonant";
                           }
                    getch();
                    }
                   
Run the program using Ctrl+F9
                   
Output:


First Run
 Enter any character between a to z : e
 e is vowel
Second Run
 Enter any number between a to z: z

 z is consonant
Categories:

0 comments:

Post a Comment