C++ Program to Check character is Vowel or Consonant

In this tutorial you will learn about the C++ Program to Check character is Vowel or Consonant and its application with practical example.

In this tutorial, we will learn to create a C++ Program to Check character is Vowel or Consonant. In this example we will check whether the entered character by the user is a vowel or a consonant using C++ programming.

Before starting with this tutorial we assume that you are best aware of the following C ++ programming topics:

  • Operators
  • Condition statement.
  • logical operator.
  • Basic input/output.
  • Basic C++ programming.

What Is Vowel and consonant?

Vowel :=> Sound that allowing breath to flow out of mouth, without closing any part of the mouth is called as vowel.
Consonant:=> Sound  made by blocking air from flowing out of the mouth with the teeth or throat is called as Consonant.

Example

As we know A E I O U are called vowels. And renaming alphabets except these 5 vowels are called consonants.

Program to Check the given value is Vowel or consonant.

So here we creating a program in which we will find the given character is vowel or consonant.
As we know a,e,i,o,u are only vowel and rest are consonant.So simply we will check these and if given character belongs to them  then it is a vowel  and if not its consonant simple isn’t it .let’s have a look at program.

Output

C++ Program to Check character is Vowel or Consonant.

Note: Here we assumes that the user will enter an alphabet. If not so then non-alphabetic character, it displays the character is neither a vowel nor a consonant.

In the above program, we have first declared a variables required in the program.

  • ch= hold given character.

First of all user prompted to enter any character which will be assign in ch variable.

Then with the help of if-else statement we will check the inputted character is a vowel or consonant, using following logic

As user inputs any character we will check whether it’s a vowel both in lower-case and upper-case condition we check if  belongs to in vowel or consonant. if it is vowel we will show following message.

If a character doesn’t belong to this condition then it is consonant ,

and if  doesn’t meet any of them vowel and consonant it might be a digit or a special symbol.

So in this tutorial we have learn to find given character is vowel or consonant.

In this tutorial we have learn about the C++ Program to Check character is Vowel or Consonant and its application with practical example. I hope you will like this tutorial.