In this article, you will learn a C++ program to check vowels. There are 5 vowels in the English language that are A, E, I, O, and U. These letters have vocal sounds open and without friction.
This program asks the user to enter any character and display whether it’s a vowel or consonant. All the latter other than vowels are consonants.
Example: C++ program to check vowel
// C++ program to check vowel
#include<iostream>
using namespace std;
int main()
{
char c;
cout<<"Enter any character: ";
cin>>c;
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||
c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
{
cout <<"Your entered character "<< c << " is a vowel";
}
else
{
cout <<"Your entered character "<< c << " is a consonant";
}
return 0;
}