/********************************************************************* Ed Yakabosky CSE 103 Section 003 This is the second homework program for CSE 103. Its purpose is to build a math tutor for a student learning basic arithmetic. The program will randomly generate two numbers and create addition, subtraction, multiplication, and division problems. Students will be told if their answers are correct or not. input: none. output: arithmetic problems, correct or not. *********************************************************************/ #include #include #include using namespace std; bool quit = false; //initializes a boolean that determines whether //program exits or not. bool mainmenu = false; //initializes a boolean that determienes whether //program goes to main menu. int difficulty = 0; //initializes an integer for selecting difficulty level. int mathtype = 0; //initializes an integer for selecting type of computation. int numA = 0; //initializes an integer that represents first number //in computation. int numB = 0; //initializes an integer that represents second number //in computation. int result = 0; //initializes an integer that is the result of computation. int guess = 0; //initializes an integer that is the student inputs to //guess result. int main() { while (!quit) { /* This block of code outputs the Difficulty Selection Menu to the console */ mainmenu = false; /* mainmenu is reset to false everytime the Difficulty Menu is visited so that the cases of switch (difficulty) can run.*/ cout<<"Ed's Math Tutor 1.0\n"<>difficulty; switch (difficulty) { //When user inputs 1 for difficulty, easy difficulty loop runs. case 1: while (!mainmenu) { //This outputs the menu where student selects desired type //of computation. cout<<"Please select one of the following"<< cout<<" arithmetic problems:\n"<>mathtype; switch (mathtype) { /* When user selects 1 for mathtype, an addition problem is generated. The student enters a guess for the sum and the program returns whether the guess is correct or not. It then calls a break and returns to the previous menu.*/ case 1: numA = (rand() % 10) + 1; numB = (rand() % 10) + 1; result = numA + numB; cout<<"\n"<>mathtype; switch (mathtype) { /* When user selects 1 for mathtype, an addition problem is generated. The student enters a guess for the sum and the program returns whether the guess is correct or not. It then calls a break and returns to the previous menu.*/ case 1: numA = (rand() % 50) + 1; numB = (rand() % 50) + 1; result = numA + numB; cout<<"\n"<>mathtype; switch (mathtype) { /* When user selects 1 for mathtype, an addition problem is generated.The student enters a guess for the sum and the program returns whether the guess is correct or not. It then calls a break and returns to the previous menu.*/ case 1: numA = (rand() % 100) + 1; numB = (rand() % 100) + 1; result = numA + numB; cout<<"\n"<