
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements