Check if a character is vowel - C++ Program

Q. Write a C++ program to check whether the entered character is a vowel or not.

Answer:

Following program shows that whether the entered character is vowel or not.

#include<iostream>
using namespace std;
int main()
{
        char ch;
        cout<<"Enter an Alphabet : ";
        cin>>ch;
        if(ch=='a' || ch=='A' || ch=='e' || ch=='E' || ch=='i' || ch=='I' || ch=='o' || ch=='O' || ch=='u' || ch=='U')
        {
                cout<<"This is a Vowel";
        }
        else
        {
                cout<<"This is Not a Vowel";
        }
        return 0;
}


Output:

vowel