codescracker


c++

C++ Program to Check Vowel or Not



« Previous Program Next Program »


Check Vowel or Not in C++

To check whether the input alphabet is a vowel or not a vowel in C++ Programming, you have to ask to the user to enter a character and check the character for vowel. The character is vowel, only if it is equal to a, A, e, E, i, I, o, O, u, U. Otherwise the character will not be a vowel as shown here in the following program.

C++ Programming Code to Check Vowel or Not

Following C++ program ask the user to enter an alphabet to check whether it is a vowel or not, then display the result on the screen:

/* C++ Program - Check Vowel or Not */
		
#include<iostream.h>
#include<conio.h>
void main()
{
	clrscr();
	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";
	}
	getch();
}

When the above C++ program is compile and executed, it will produce the following result. Above C++ Programming Example Output (for vowel):

C++ program check vowel

Above C++ Programming Example Output (for now vowel):

program check vowel c++ programming

Same Program in Other Language

You may like the same program in other programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test