Making it harder than it is?
I'm trying to write a program where the user inputs a sentence, then outputs the number of vowels. But I'm trying to use a function "isVowel" where I first go through the sentence and return true for any vowel, and otherwise false. This is what I have... and I have a feeling I'm making this harder than it needs to be. Help?
Code:
#include <iostream>
using namespace std;
bool isVowel(char);
int main()
{
int sum;
char vowel;
string sentence;
cout << "Enter a sentence" << endl;
getline(cin, sentence);
cout << "There are " << isVowel(sum) << " vowels in this sentence." << endl;
return 0;
}
bool isVowel(char sum)
{
sum = sum + true;
if ("A" || "a" || "E" || "e" || "I" || "i" || "O" || "o" || "U" || "u")
return true;
else
return false;
return sum;
}