#include <iostream>
usingnamespace std ;
bool input(char);
int main()
{
char x ;
bool a ;
cout << "Please enter an alphabet :"<<endl;
cin >> x ;
a=input(x);
{if (a=true)
cout << "The alphabet inserted is a vowel \n:";
else
cout <<"The alphabet inserted is not a vowel \n:";
}
system ("pause");
return 0;
}
bool input(char x)
{
bool vowel ;
switch (x)
{
case'A':
case'a':
case'E':
case'e':
case'I':
case'i':
case'O':
case'o':
case'U':
case'u':
vowel = true ;
break ;
default:
vowel = false;
break ;
}
return vowel;
}
This program should detect whether the character entered is a vowel , but the bool input (char x) function only return true value no matter what character I key in , please help .