In this post, we will write a C++ program to find out whether the given character is a vowel or not. user will enter the character and the program will print whether is given character is a vowel or not.
C++ program to find out given character is a vowel or not.
#include<iostream>
#include<conio.h>
int main(void)
{
char y;
std::cout<<"Press any character = ";
std::cin>>y;
switch(y)
{
case 'a':
std::cout<<"The given character is vowel";
break;
case 'e':
std::cout<<"The given character is vowel";
break;
case 'i':
std::cout<<"The given character is vowel";
break;
case 'o':
std::cout<<"The given character is vowel";
break;
case 'u':
std::cout<<"The given character is vowel";
break;
default:
std::cout<<"The given character is not vowel";
}
return 0;
}
Output
Press any character = e The given character is vowel