Hello,
I'm working on a program with value returning functions and I just can't seem to be able to define each of my symbols for the set of problems my program is suppose to execute.
So below is my code and what the output "should" look like. This program first asks the user how many problems they want in each set (there is a defined number of 3 sets). Then the user is asked to choose a max number to which the randomly generated numbers may go up to. I had to limit the number to 100. The program outputs problems and the user is asked to give an answer. The first set is all addition, the second is subtraction, and the third is multiplication. What my problem is how i can define each symbol for each function? The program calculates the correct answer and compares it to the user's input. At the end, the program outputs the number and percentages of each: the first set, second set, third set, and overall.
CODE:
[code removed]
Desired sample OUTPUT:
Enter problems per set: 3
Set #1
----------
What is the maximum number for this set? 100
Set #3
----------
What is the maximum number for this set? 20
0 * 18 = 0
correct
15 * 4 = 398
incorrect
8 * 17 = 873
incorrect
Set#1: You got 2 correct out of 3 for 67%
Set#2: You got 2 correct out of 3 for 67%
Set#3: You got 1 correct out of 3 for 33%
Overall you got 5 correct out of 9 for 56%
Unless you use code tabs your OP is hard to read. Select the code and hit '#'.
If I'm reading you correctly........ you could use a switch(operator) statement with the cases being case('+'): and so on.
yea, you are reading me correctly and thank you, i put in the switch statement. now my only problem is that for each set of problems i need to calculate the number of correct problems. the thing is i cant send no more than 3 arguments to doOneSet:
int main()
{
srand(time(0));
getProbsPerSet(<arguments>);
doOneSet(<no-more-than-3-arguments>);
doOneSet(<no-more-than-3-arguments>);
doOneSet(<no-more-than-3-arguments>);
printReport(<arguments>);
}
the hint my teacher gave us was:
"Although main will need three separate variables to keep track of the number of problems answered correctly in each set, your doOneSet function will have only one parameter which keeps track of the number of problems answered correctly in the current set. It will be up to main to get that information into the correct variable. "
but I don't really know how that would work. any ideas? This is my code so far: