C++ Program to Check Whether the Character is Vowel, Consonant or Special Character

C++ Program to Check Whether the Character is Vowel, Consonant or Special Character  



source code : 

//wap to check whether a character is vowel or consonants
#include<iostream>
using namespace std;
int main(){
    int t;
    cout<<"ENter the number of test cases"<<endl;
    cin>>t;
    for(int i=1;i<=t ;i++){

    char ch;
    cout<<"ENter the character "<<endl;
    cin>>ch;
    if(ch=='a' || ch=='e' || ch=='i'||ch=='o'||ch=='u')
    cout<<"This is lower case vowel letter"<<endl
    else if(ch=='A' || ch=='E' || ch=='I'||ch=='O'||ch=='U')
    cout<<"THis is upper case vowel letter "<<endl;
    else if (ch>=65  && ch<=90)
    cout<<"This is upper case consonant letter"<<endl;
    else if (ch>=97  && ch<=122)
    cout<<"THis is lower case consonat letter"<<endl;
    else
    cout<<"This is special character"<<endl;
}
    return 0;

}
output :
Previous
Next Post »