hey guys...my code is working fine..only problem i have is my first do-while loop doesnt work...every time i try to compare the word given by the user to 'q' ||'Q'...it gives an error saying no match for the operator..please help me ....thanks!
#include <iostream>
#include <string>
using namespace std;
bool isVowel(char c); // returns true if c is a vowel and false otherwise
int countVowels(string s); // returns the number of vowels in s.
int main ()
{
string word;
int answer;
do
{
cout << "Please enter a word or 'q' to quit: ";
cin >> word;
answer = countVowels(word);
cout << answer << endl;
}
while (word != 'q' || word != 'Q')
return 0;
}
int countVowels(string s)
{
int i;
int total = 0;
for (i = 0; i < (s.length()); i++)
{
if (isVowel(s[i]))
total++;
}
return total;
}
bool isVowel (char c)
{
bool status;
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
status = true;
else
status = false;
return status;
}