
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Program to find if a character is vowel or Consonant in C++
In this tutorial, we will be discussing a program to find if a character is a vowel or consonant.
For this, we will be provided with a character. Our task is to print out to the user whether the provided character is a vowel or a consonant.
Example
#include <iostream> using namespace std; //checking if the character is a vowel or consonant void is_vowel(char x){ if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') cout << "Vowel" << endl; else cout << "Consonant" << endl; } int main(){ is_vowel('c'); is_vowel('e'); return 0; }
Output
Consonant Vowel
- Related Articles
- Java program to find whether given character is vowel or consonant
- C++ Program to Check Whether a character is Vowel or Consonant
- Java program to find whether given character is vowel or consonant using switch case
- Java Program to Check Whether an Alphabet is Vowel or Consonant
- Alternate vowel and consonant string in C++
- Alternate vowel and consonant string in C/C++?
- Vowel, other characters and consonant difference in a string JavaScript
- C# Program to check if a character is a whitespace character
- Python program to check if the given string is vowel Palindrome
- How to find edit text values start from consonant or not?
- Print all Subsequences of String which Start with Vowel and End with Consonant in C++
- Java program to find whether the given character is an alphabet or not
- Java Program to Check Whether a Character is Alphabet or Not
- C++ Program to Check Whether a Character is Alphabet or Not
- JAVA Menu Driven Program to Check Character is String, Number or Special Character

Advertisements