C++ Program to check whether a Character is Vowel or Consonant using if–else.
Write a program in CPP to check whether a character is vowel or consonant using if –else condition. The Program for checking a character to be a vowel or a consonant is pretty easy. The given code is used in c++ (cpp) programming language. The compiler used for this code may be Dev-CPP or CodeBlocks. This code can also be used in Turbo CPP by making a little changes. The source code for Dev-CPP or CodeBlocks to check whether a character is vowel or consonant using if –else condition is: Source Code: Input: #include<iostream> #include<stdio.h> using namespace std; int main() { char x; cout<<"Enter the alphabet."<<endl; cin>>x; if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u') cout<<"The alphabet you entered is vowel"; else cout<<"The alphabet you entered is consonant"; return 0; } Source Code for Turbo CPP: #include...