fastread homefastrread library fastread menu

C++ : Check Whether a character is Vowel or Consonant.

Tutorial by:Manisha Dubey      Date: 2016-06-18 04:12:03

❰ Previous Next ❱

Alphabets a, e, i, o and u are vowels and all alphabets except these letters are consonants.

This program below takes character input from user and checks whether that letter is vowel alphabet or not using if...else statement

 

 
 

Source Code

#include <iostream>
using namespace std;

int main() {
    char c;
    cout << "Enter an alphabet: ";
    cin >> c;
    if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U') {
        cout << c << " is a vowel.";
    }
    else {
        cout << c << " is not a vowel.";
    }
    
    return 0;
}

Output

Enter an alphabet: u
g is a vowel.

❰ Previous Next ❱


C++

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website