Vowel or Consonant check in C++

Vowel or Consonant check in C++

How can we check vowel or consonant in C++? We use character variable to check this program and 'cout' to print the result.

Vowel or Consonant in C++ :


#include <iostream> using namespace std; int main() { char ch; cout << "Please Enter Your Own Character : "; cin >> ch; if(ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u' or ch == 'A' or ch == 'E' or ch == 'I' or ch == 'O' or ch == 'U') cout << "The Given Character " << ch << " is a Vowel"; else cout << "The Given Character '" << ch << "' is a Consonant"; return 0; }

Output :