So I have been trying to create a program to match the requirments given in ym current assignment.
Write a program that quizzes students on simple integer arithmetic problems involving addition, subtraction, multiplication, or division.
The tutor begins by prompting the user for the difficulty of the problem by choosing the number of digits (1, 2, 3, or 4).
Next the program begins a loop which display a menu allowing the user to select addition, subtraction, multiplication, division, or quit (for the user to quit the program).
The program display a problem with two random positive integers and the chosen arithmetic operator.
The program pauses while the student works on the problem.
When the student is ready to check the answer, he or she can press any key and the program will display the correct answer.
The program returns to beginning of the loop by displaying the menu again.
Other Requirements:
1. Allow the user to choose the number of digits only once. The maximum number of digits should be 4 (error checking required)
2. Display a menu of arithmetic operators continues to loop until user chooses option to quit. (error checking required)
3. Display each problem using a vertical format with all digits aligned. (See examples below)
4. Display appropriate arithmetic operators for tutoring beginning math students:
5. (+) Addition, (-) Subtraction, (x) Multiplication, (÷) Division, and (─) Line.
6. (ASCII character 196 is used for line, ASCII Character 246 for division operator, lower case x for multiplication operator)
7. For division, integer division should be used. The result should display the integer value with remainder (modulus) marked as a "R" and the remainder.
8. All problems should involve positive integers.
I am really new to this and am completely at a loss, I can't get to the next step of having it recognize a level selection and displaying a problem to be solved, accepting an answer and repeating.... yeah I am dense for sure at this.
so far i have a menu that allows selections from the second menu and repeats any other steps i tried crashed and burned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int option;
int mlevel;
int dlevel;
int slevel;
int alevel;
int choice;
int answer;
int key;
do //do-while loop starts here.that display menu again and again until user select to exit program
{
//Displaying Options for the menu
cout << "Please choose one of the following options:" << endl;
cout << " [1] Addition" << endl;
cout << " [2] Subtraction" << endl;
cout << " [3] Multiplication" << endl;
cout << " [4] Division" << endl;
cout << " [5] Quit" << endl;
cin >> key; // taking option value as input and saving in variable "option"
if(key == 1) // Checking if user selected option 1
{
cout << " level [1] " << endl;
cout << " level [2] " << endl;
cout << " level [3] " << endl;
cout << " level [4] " << endl;
cin >> alevel;
}
else if(key == 2) // Checking if user selected option 2
{
cout << " [1] " << endl;
cout << " [2] " << endl;
cout << " [3] " << endl;
cout << " [4] " << endl;
cin >> slevel;
}
else if(key == 3) // Checking if user selected option 3
{
cout << " [1] " << endl;
cout << " [2] " << endl;
cout << " [3] " << endl;
cout << " [4] " << endl;
cin >> mlevel;
}
else if(key == 4) // Checking if user selected option 4
{
cout << " [1] " << endl;
cout << " [2] " << endl;
cout << " [3] " << endl;
cout << " [4] " << endl;
cin >> dlevel;
}
}while(key != 5); //condition of do-while loop
return 0;
}
|