Functions not calling properly.

Since this is homework, I am not asking for a solution. I am just asking for a bit of guidance. Whenever I am trying to function call, it for some reason loops around both MathMenu() and diff(). I can't seem to properly stack the multiple functions and have them reference each other correctly. Any tips or suggestions on where I can go from here? Or hint at what am I not seeing?
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
126
127
128
129
130
131
132
133
134
#include <ctime>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int MathMenu(int &);
int diff(int &);
int add(int &);
int app(int &);

int main() {
	int a=0;
	int b=0;
	int c=0;
	
	for (int i = 0; i == a; i++) {
		diff(a);
		for (int j = 0; j == b; j++) {
			add(b);
			for (int k = 0; k == c; k++) {
				app(c);
			}
		}
	}
}

int MathMenu(int & choice) {
	cout << "Main Menu" << endl
		<< "__________" << endl
		<< "1.) Addition Problems" << endl
		<< "2.) Subtraction Problems" << endl
		<< "3.) Multiplication Problems" << endl
		<< "4.) Division Problems" << endl;
	cin >> choice;
	while (choice < 1 || choice >5)
	{
		cout << "Main Menu" << endl
			<< "__________" << endl
			<< "1.) Addition Problems" << endl
			<< "2.) Subtraction Problems" << endl
			<< "3.) Multiplication Problems" << endl
			<< "4.) Division Problems" << endl;
		cin >> choice;
		return choice;
	}
	return choice;
}

int diff(int & difficulty) {
	int choice2 = MathMenu(choice2);
	if (choice2 == 1) {
		cout << "Enter the difficulty level. Difficulty will increase with higher levels." << endl
			<< "Enter Difficulty: ";
		cin >> difficulty;
		while (difficulty < 1)
		{
			cout << "Error. Difficulty must be greater then 0.Enter the difficulty level. Difficulty will increase with higher levels." << endl
				<< "Enter Difficulty: ";
			cin >> difficulty;
		}
		int add(int &);
	}
	else if (choice2 == 2) {
		cout << "Enter the difficulty level. Difficulty will increase with higher levels." << endl
			<< "Enter Difficulty: ";
		cin >> difficulty;
		while (difficulty < 1)
		{
			cout << "Error. Difficulty must be greater then 0.Enter the difficulty level. Difficulty will increase with higher levels." << endl
				<< "Enter Difficulty: ";
			cin >> difficulty;
		}
	}
	else if (choice2 == 3) {
		cout << "Enter the difficulty level. Difficulty will increase with higher levels." << endl
			<< "Enter Difficulty: ";
		cin >> difficulty;
		while (difficulty < 1)
		{
			cout << "Error. Difficulty must be greater then 0.Enter the difficulty level. Difficulty will increase with higher levels." << endl
				<< "Enter Difficulty: ";
			cin >> difficulty;
		}
	}
	else if (choice2 == 4) {
		cout << "Enter the difficulty level. Difficulty will increase with higher levels." << endl
			<< "Enter Difficulty: ";
		cin >> difficulty;
		while (difficulty < 1)
		{
			cout << "Error. Difficulty must be greater then 0.Enter the difficulty level. Difficulty will increase with higher levels." << endl
				<< "Enter Difficulty: ";
			cin >> difficulty;
		}
	}
	return difficulty;
}

int add(int & modifier)
{
	const int min = 0;
	const int max = 9;
	int seed = static_cast <int> (time(0));
	srand(seed);
	int level = diff(level);
	int num1 = seed % 10;
	int num2 = seed % 10;
	srand(num1);
	srand(num2);
	int ans;
	int cans = num1 + num2;
	cout << "What is " << num1 << " + " << num2 << "? ";
	cin >> ans;
	modifier =  rand() % 4;
	srand(modifier);
	return modifier;

}

int app(int & mod) {
	mod = add(mod);
	if (mod == 1)
		cout << "Very Good!";
	else if (mod == 2)
		cout << "Excellent!";
	else if (mod == 3)
		cout << "Nice work!";
	else if (mod == 4)
		cout << "Keep up the good work!";
	system("Pause");
	return 0;
}

Main Menu
__________
1.) Addition Problems
2.) Subtraction Problems
3.) Multiplication Problems
4.) Division Problems
1
Enter the difficulty level. Difficulty will increase with higher levels.
Enter Difficulty: 1
Main Menu
__________
1.) Addition Problems
2.) Subtraction Problems
3.) Multiplication Problems
4.) Division Problems
1
Enter the difficulty level. Difficulty will increase with higher levels.
Enter Difficulty: 1
What is 7 + 7?

Last edited on
Line 63 is a prototype not a function call. Change it to add(a) or so.

By the way:
The parameter you pass to the functions is useless. Better use local variables instead.
Line 18/20/22 are no real loops.
I will give that a try, thanks!
Topic archived. No new replies allowed.