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;
}
0 Comments: