C++ program to check whether given alphabet is vowel or consonant.

#include<iostream.h>
#include<conio.h>
void main(){
char ch;
clrscr();
cout<<"Enter an alphabet"<<endl;
cin>>ch;
if((ch>=65 && ch<=90)||(ch>=97 && ch<=122)){
switch(ch){
case 'A': case 'a': case 'E': case 'e': case 'I': case 'i': case 'O': case 'o': case 'U': case 'u':
cout<<ch<<" is Vowel"<<endl;
break;
default:
cout<<ch<<" is Consonant"<<endl;
}
}
else{
cout<<"Not an Alphabet"<<endl;
}
getch();
}

No comments:

Post a Comment