Now here are some suggestions to improve your code. I completely understand if you want to ignore these. If you choose to try them, SAVE YOUR WORK first. You don't want to try to "improve" the code and end up with a non-working program when it's time to turn it in.
Okay, here are some thoughts.
- You don't need variables index and index2 because studentNum and i do the trick. Change 11 to: cout << "Student #" << studentNum + 1 << " Name: "; and change line 20 to: cout << " Test #" << i + 1 << ": ";
Also, there's no reason to update average each time through the inner loop. Only the last value matters. So move line 25 to line 29 so it's outside the inner loop.
You're trying to use the grade member of Student for 2 entirely different things - to store the average result, and then to store a single-character grade. That makes no sense at all.
I don't understand why you're copying average into grade at all. What is the point of that? Why do you not simply test the value of average?
You are right I do not know why I was trying to store double integer into a char, how i rewrote it was that if the average is in a range of number then char should equal a letter like so:
Yep, that's right. Although you could easily have tried it for yourself.
You could even use your debugger to step through your code, so that you can see exactly which lines are executing, and can see which if statements are evaluating to true or false.