Question: Hi. I have a code I wrote and I dont know how to do this last phase part and what it means. Below is my

Hi. I have a code I wrote and I dont know how to do this last phase part and what it means. Below is my code and attached is the instructions.

#include

#include

using namespace std;

void doOneSet(char,int,int&);

bool doOneProblem(char,int);

void generateOperands(int&,int&,int);

int calculateCorrectAnswer(int,int,char);

bool checkAnswer(int,int);

void getProbsPerSet(int&);

void printHeader(char);

int getMaxNum();

void printReport(int,int,int,int);

int main()

{int probsPerSet,correctAdd=0,correctSub=0,correctMult=0;

srand(time(0));

getProbsPerSet(probsPerSet);

doOneSet('+', probsPerSet,correctAdd);

doOneSet('-', probsPerSet,correctSub);

doOneSet('*', probsPerSet,correctMult);

printReport(probsPerSet,correctAdd,correctSub,correctMult);

system("pause");

}

void printReport(int set,int add,int sub,int mult)

{

cout

cout

cout

}

void printHeader(char op)

{int set = 0;

switch(op)

{{case '+': set=1; break;

case '-': set=2; break;

case '*': set=3; break;

}

}

cout

}

int getMaxNum()

{int max;

cout

cin>>max;

return max;

}

void doOneSet(char op,int n,int& correct)

{int i,max;

printHeader(op);

max=getMaxNum();

for(i=0;i

if(doOneProblem(op,max))

correct++;

}

bool doOneProblem(char op,int max)

{int ans,user,op1,op2;

generateOperands(op1,op2,max);

ans=calculateCorrectAnswer(op1,op2,op);

cout

cin>>user;

if(checkAnswer(ans,user))

return true;

else

return false;

}

void generateOperands(int& op1,int& op2,int max)

{op1=rand()%(max+1);

op2=rand()%(max+1);

}

int calculateCorrectAnswer(int op1,int op2,char op)

{switch(op)

{case '+': return op1+op2;

case '-': return op1-op2;

default: return op1*op2;

}

}

bool checkAnswer(int ans,int user)

{if(ans==user)

{cout

return true;

}

else

{ cout

return false;

}

}

void getProbsPerSet(int& probsPerSet)

{cout

cin>>probsPerSet;

}Hi. I have a code I wrote and I dont know how

Your main function for phase VI must look like this (you may add variable declarations and arguments only): int main) int probsPerSet; int setiCorrect, set2Correct, set3Correct srand (time(0)); getProbsPerSet () dooneSet (no-more-than-3-arguments>) doOneSet ); doOneSet ); printReport () Please note that you may send no more than 3 arguments to doOneSet. Hint: 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. The following structure diagram includes every function that you will have in your program. You should have no more and no fewer, and you should use the names that have been suggested here. Functions pictured below that are not labeled with a phase should be implemented at least by phase III. Please also read the notes below the structure diagram very carefully

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!