Question #3342

Write a program to check the given character is vowel or not?

Expert's answer

#include <iostream>
using namespace std;

int main()
{
char given_character;
cout << "Please input a character: ";
cin >> given_character;

bool vowel = false;
switch (given_character) {
& case 'a': case 'A':
& case 'e': case 'E':
& case 'o': case 'O':
& case 'i': case 'I':
& case 'u': case 'U':
& vowel = true;
}
&
& if (vowel) cout << "The given character is vowel." << endl;
else& cout << "The given character isn't vowel." << endl;
return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS