Introduction: In previous article i explained Else if ladder or multiple else if to check the day corresponding to number in C++ Language and Else if ladder or multiple else if to check the month corresponding to number in C++ Language. In this article i will explain how to check whether entered character is Vowel or Consonant using ladder else if or we can say multiple else if in C++ Language. Vowels are a,e,i,o,u and all other alphabets other than the Vowels are 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 : u
u is vowel
Second Run
Enter any number between a to z: p
p is consonant
If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..