Check Vowel in C++
Q.Write a C++ program to check a character is vowel or not.
#include <iostream>
using namespace std;
int main()
{
char ch;
cout << "Enter a character: ";
cin >> ch;
if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I'
|| ch =='o' || ch=='O' || ch == 'u' || ch == 'U')
{
cout << ch << " is a vowel.";
}
else
{
cout << ch << " isn't a vowel.";
}
return 0;
}
Q. Write an algorithm to check a character is vowel or not.
1. Start 2. Input character `ch` from the user 3. Check if the character `ch` is one of the following (case-insensitive): - `a` or `A` - `e` or `E` - `i` or `I` - `o` or `O` - `u` or `U` If yes, then: - Print "`ch` is a vowel." 4. Else: - Print "`ch` isn't a vowel." 5. End
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com