How to Check Vowel or Consonant using Switch Case
Here you will get the source code of C++ Program to Check Vowel or Consonant using Switch Case.
The letters A, E, I, O, U are called vowels and all other letters in the alphabets are called Consonants.
C++ Program to Check Vowel or Consonant using Switch Case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include<iostream> using namespace std; int main() { char ch; cout<<"Enter an Alphabet to check vowel or consonant : "; cin>>ch; switch(ch) { case 'a': case 'e': case 'i': case 'o': case 'u': case 'A': case 'E': case 'I': case 'O': case 'U': cout<<ch<<" is a Vowel"; break; default: cout<<ch<<" is a Consonant"; break; } return 0; } |
Output 1
Enter an Alphabet to check vowel or consonant : u
u is a Vowel
Output 2
Enter an Alphabet to check vowel or consonant : R
R is a Consonant
Check out our other C++ programming Examples