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()
{
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
0 comments:
Post a Comment