Write a C++ program to input an alphabet and check whether it is vowel or consonant using switch case.

Write a C++ program to input an alphabet and check whether it is vowel or consonant using switch case.

 Question:






Answer:



C++ program find whether the given alphabet is a vowel or a consonant.
#include<iostream>
using namespace std;
int main()
{
char ch;
cout<<"Enter an alphabet : ";
cin>>ch;
switch(ch)
{
case 'a' : cout<<"Vowel";
break;
case 'e' : cout<<"Vowel";
break;
case 'i' : cout<<"Vowel";
break;
case 'o' : cout<<"Vowel";
break;
case 'u' : cout<<"Vowel";
break;
case 'A' : cout<<"Vowel";
break;
case 'E' : cout<<"Vowel";
break;
case 'I' : cout<<"Vowel";
break;
case 'O' : cout<<"Vowel";
break;
case 'U' : cout<<"Vowel";
break;
default : cout<<"Consonant";
}
return 0;
}
Previous Post
Next Post

post written by:

0 Comments: