value returning function problem

Nov 27, 2017 at 8:26pm
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;
}
}
Nov 27, 2017 at 8:57pm
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 Nov 27, 2017 at 9:01pm
Nov 27, 2017 at 10:42pm
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 Nov 27, 2017 at 10:45pm
Nov 28, 2017 at 1:34pm
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?
Nov 28, 2017 at 1:45pm
aeiou are vowels
Score is based on output
and yes
Topic archived. No new replies allowed.