. Write a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false.
#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;
}
Comments
Leave a comment