#include <iostream>
#include <string>
usingnamespace std;
bool isVowel(char x);
int main()
{
string phrase;
bool flag;
int counter = 0;
cout << "Enter a series of characters: ";
getline(cin, phrase);
for (int i = 0; i < phrase.length(); i++)
{
flag = isVowel(phrase[i]);
if (flag)
counter++;
}
cout << "There are " << counter << " vowels in " << phrase << endl;
system("pause");
return 0;
}
bool isVowel(char x)
{
x = toupper(x);
if ((x == 'A') || (x == 'E') || (x == 'I') || (x == 'O')|| (x == 'U')|| (x == 'Y'))
returntrue;
elsereturnfalse;
}
_You can't get a "series of characters" in a single char, however you can use getline to give you a string.
_You weren't doing anything anyway with the char ch after you got input from user
_You can use toupper to have a smaller if statement, also you forgot the vowel 'y' :)