Program to identify a given character is a vowel or a consonant
Program to identify a given character is a vowel or a consonant #include<iostream> using namespace std; int main() { char c; cout<<"enter an alphabet "; //prints the msg between "" cin>>c; int isuppercase,islowercase; // declaration of variables islowercase=(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'); / / initialization of variables isuppercase=(c=='A'||c=='E'||c=='I'||c=='O'||c=='U'); // initialization of variables if(isuppercase || islowercase) { cout<<"you entered "<< c <<" is a vowel"; //prints the msg between "" } else { cout<<"you entered "<< c <<" is a consonant"; //prints the msg between "" } return 0; } Output: enter an alphabet q you entered q is a consonant