I'm getting the error in this chunk of code. I think it has something to do with how I formatted my switch statement, but I'm not sure.
Ignore all the counters posted as parameters up there. I am going to add them as counters under each grade but I get the same error whether or not they are used in the body of the function.
This isn't formatted as per C++. So yes, you will get an error: '0 ... 59' is invalid C++, it does not mean "0 to fifty nine". would mean a character with the code 0 ... 59 which is a completely invalid character.
What you want will be this:
1 2 3 4 5 6 7 8
char Grade(int avg)
{
if (avg < 60) return'F';
if (avg < 70) return'D';
if (avg < 80) return'C';
if (avg < 90) return'B';
return'A';
}
Just curious the reason why you don't need if else is because it will just go down the line and doesn't matter if the other ones after it might qualify because it has already returned?