Please help im so lost and very new.

I need help writing a math tutor program that goes under these guidlines
---------------------------------
When you run your Math Tutor program the output should look like the following.
Important to remember that you should generate random numbers between 10 and 50.

-----------------------------------
Math Tutor - Main Menu

1. Addition
2. Subtraction
3. Multiplication
4. Exit program

Choose your operation to practice (1-4): 1

Working with addition:

21
+17
---
Your answer: 38
Correct answer: 38 Congratulation!

Math Tutor - Main Menu

1. Addition
2. Subtraction
3. Multiplication
4. Exit program

Choose your operation to practice (1-4): 2

Working with subtraction:

36
-27
---
Your answer: 8
Correct answer: 9 Sorry!

Math Tutor - Main Menu

1. Addition
2. Subtraction
3. Multiplication
4. Exit program

Choose your operation to practice (1-4): 3

Working with multiplication:

11
*13
---
Your answer: 143
Correct answer: 143 Congratulation!

Math Tutor - Main Menu

1. Addition
2. Subtraction
3. Multiplication
4. Exit program

Choose your operation to practice (1-4): 7

Incorrect menu selection. Please choose between 1 and 4.

Math Tutor - Main Menu

1. Addition
2. Subtraction
3. Multiplication
4. Exit program

Choose your operation to practice (1-4): 4

Thank you for using Math Tutor.

-----This program is suppose to loop until the user selects option 4.------------ Heres what I have and I have become very lost------



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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125


#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;

int main(void)
{
	srand(time(0));
	int choice = 0;
	int digits = 1;
    
    // Show menu and get users choice
    cout << " Math Tutor - Main Menu \n";
    cout << "Choose your operation to practice (1-4): \n";
    cout << "1. Addition \n";
    cout << "2. Subtraction \n";
    cout << "3. Multiplication \n";
    cout << "4. Exit program \n";
    cin  >> choice;
    
    
    //Validate menu selection
    while ((choice < 1) || (choice > 4))
  
    {
        
        cout << "Incorrect menu selection. Please choose between 1 and 4. ";
        cin >> choice;
        
       
    }

    while (choice == 4)
    
    {
        cout << "Thank you for using Math Tutor! " << endl;
        return 0;
    }

    
    { 
    
    int num1 = 1;
    int num2 = 2;
    int total = 3;
    int answer = 3;
 
    for (int i = digits; i > 0; i--)
    {
        num1 *= 100;
        num1 += (rand() % 9) + 1;
    }
    for (int i = digits; i > 0; i--)
    {
        num2 *= 100;
        num2 += (rand() % 9) + 1;
    }

    
    {
        if (choice == 1)
        {
        if (choice == 1)
        cout << "Working with addition: ";
        cout << num1 << " + " << num2 << endl;
    
        }
    if (choice == 2)
    {
        cout << "Working with subtraction: ";
        cout << num1 << " - " << num2 << endl;
    }

        {   if (choice == 3)
        cout << "Working with multiplication: ";
        cout << num1 << " x " << num2 << endl;

        }

    //Display equation
    cin >> answer;

    switch(choice)
    {
        case 1:
            total = num1 + num2;
            break;
        case 2:
            total = num1 - num2;
            break;
        case 3:
            total = num1 * num2;
        
    }
        if(answer == total)
    {
    if (answer == total)
    cout << endl;
    cout << " Your answer is " << answer << endl;
    cout << " The correct answer is " << total << " Congratulations" << endl;
    }
    else
{   cout << endl;
    cout << " Your answer is " << answer << endl;
    cout << " The correct answer is " << total << " Sorry !" << endl;
}
        do
        {	// Loop unless user selectsShow menu and get users choice
            cout << " Math Tutor - Main Menu \n";
            cout << "Choose your operation to practice (1-4): \n";
            cout << "1. Addition \n";
            cout << "2. Subtraction \n";
            cout << "3. Multiplication \n";
            cout << "4. Exit program \n";
            cin  >> choice;
            
        }  while ((choice < 5) || (choice > 0));
        

    }
    return 0;
        
  Put the code you need help with here.
I kind of cleaned your code up for you :) Let me know if you need anything else!
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
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <ctime>
using namespace std;

int main(void)
{
	int choice;
	int num1;
	int num2;
	int total;
	int answer;

	do
	{
		//Get random numbers
		srand(time(0));
		num1 = rand() % 100;
		num2 = rand() % 100;

		// Show menu and get users choice
		cout << " Math Tutor - Main Menu \n";
		cout << "Choose your operation to practice (1-4): \n";
		cout << "1. Addition \n";
		cout << "2. Subtraction \n";
		cout << "3. Multiplication \n";
		cout << "4. Exit program \n";
		cin >> choice;

		//Validate menu selection
		while ((choice < 1) || (choice > 4))
		{
			cout << "Incorrect menu selection. Please choose between 1 and 4. ";
			cin >> choice;
		}
		if (choice == 4)
		{
			cout << "Thank you for using Math Tutor! " << endl;
			return 0;
		}
		else if (choice == 1)
		{
			cout << "Working with addition: ";
			cout << num1 << " + " << num2 << endl;
		}
		else if (choice == 2)
		{
			cout << "Working with subtraction: ";
			cout << num1 << " - " << num2 << endl;
		}
		else if (choice == 3)
		{
			cout << "Working with multiplication: ";
			cout << num1 << " x " << num2 << endl;
		}

		//Display equation
		cin >> answer;

		switch (choice)
		{
		case 1:
			total = num1 + num2;
			break;
		case 2:
			total = num1 - num2;
			break;
		case 3:
			total = num1 * num2;
		}

		if (answer == total)
		{
			cout << endl;
			cout << " Your answer is " << answer << endl;
			cout << " The correct answer is " << total << " Congratulations" << endl;
		}
		else
		{
			cout << endl;
			cout << " Your answer is " << answer << endl;
			cout << " The correct answer is " << total << " Sorry !" << endl;
		}
	} while (1);
}
Topic archived. No new replies allowed.