Answer:
Step-by-step explanation:
C++ Code
#include<iostream> //for input and output
using namespace std;
int isVowel(char ch){
if ((ch == 'A') || (ch == 'E')|| (ch == 'I')|| (ch == 'O')|| (ch == 'U')|| (ch == 'a')|| (ch == 'e')||
(ch == 'i')|| (ch == 'o')|| (ch == 'u')) {
return true;
}
else {
return false;
}
}
int main()
{
char character;
cout<<"Enter character : ";
cin >> character;
cout<<character<< " is a vowel:"<<isVowel(character);
return 0;
}
Code Explanation
Get character from user and pass that character into isVowel function.
IsVowel function then check if the character is vowel by using if statement.
if character is vowel the return true as a Boolean value.
By using Cout, Boolean value then converted into number. so it will show 1 for true and 0 for false.
Output
Case 1:
Enter character : a
a is a vowel:1
Case 2:
Enter character : b
b is a vowel:0