My final program for Math Tutor works...and I’m not 100% why. I’m just wondering if you can tell me how the parameters and arguments "numCorrect1," numCorrect2, and "numCorrect3" are receiving the number of correct answers in each set? It looks like their values are coming from a different variable "numCorrect," but I don’t know how because it seems like there’s not enough information to do this.
e.g.
nowhere in the program do I declare:
numCorrect1 = numCorrect or
numCorrect2 = numCorrect or
numCorrect3 = numCorrect
Also, I don’t know how "numCorrect" can be working correctly when I never even set its beginning value anywhere in the program. Usually, I set counts to "0" to start with. As you can see, "numCorrect1," numCorrect2, and "numCorrect3" were set to "0" in "int main()".
Also, I don’t know how "numCorrect" can be working correctly when I never even set its beginning value anywhere in the program. Usually, I set counts to "0" to start with. As you can see, "numCorrect1," numCorrect2, and "numCorrect3" were set to "0" in "int main()".
You "declared" numCorrect as a reference parameter of
1 2 3
void doOneSet(char mathOp, int probsPerSet, int& numCorrect);
void doOneProblem(char mathOp, int maxNum, int& numCorrect);
void checkAnswer(int userAnswr, int correctAnswr, int& numCorrect);
When you call this function
doOneSet('+', probsPerSet, numCorrect1);
It calls this function:
void checkAnswer(int userAnswr, int correctAnswr, int& numCorrect)