value returning function problem

I have tried this program & ran it like 10 times on the compiler on mindtap yet it still does not give me full credit.

here's the code
#include <iostream>

using namespace std;

bool isVowel(char letter);

int main()
{
char userChar;

cout << "Please enter a character: ";
cin >> userChar;

if (isVowel(userChar))
cout << userChar << " is a vowel" << endl;
else
cout << userChar << " is not a vowel" << endl;

return 0;
}

bool isVowel(char letter) {
switch (letter) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return true;
default:
return false;
}
}
I have tried this program & ran it like 10 times on the compiler on mindtap yet it still does not give me full credit.

And exactly what is the assignment?

Edit: What about 'A'?
Last edited on
The assignment is

Write a value-returning method, isVowel, that returns the value true if a given character is a vowel, and otherwise returns false
& I changed it with upper case letters

#include <iostream>

using namespace std;

bool isVowel(char letter);

int main()
{
char ch;

cout << "Please enter a character: ";
cin >> ch;

if (isVowel(ch))
cout << ch << " is a vowel" << endl;
else
cout << ch << " is not a vowel" << endl;

return 0;
}

bool isVowel(char letter) {
switch (letter) {
case 'A':
case 'a':
case 'E':
case 'e':
case 'I':
case 'i':
case 'O':
case 'o':
case 'U':
case 'u':
return true;
default:
return false;
}
}
Last edited on
You have some system, where you submit text (code) and it automatically gives some "score" for it?

1. What is a vowel? https://en.wikipedia.org/wiki/Vowel

2. What is the score based on? Output? Runtime? Size? Exact code constructs?

3. Have you written the whole program, or just the isVowel?
aeiou are vowels
Score is based on output
and yes
Topic archived. No new replies allowed.