## will_9

hi guys thanks for viewing and helping me out!!

here are the example what the things will looks like

``````Enter problems per set: 3

Set #1
----------
What is the maximum number for this set? 100

45 + 21 = 66
correct
0 + 100 = 100
correct
54 + 23 = 67
incorrect

Set #2
----------
What is the maximum number for this set? 90

59 - 19 = 40
correct
19 - 84 = -29
incorrect
0 - 65 = -65
correct

Set #3
----------
What is the maximum number for this set? 20
0 * 18 = 0
correct
15 * 4 = 398
incorrect
8 * 17 = 873
incorrect``````

and we must have fixed int main which is

``````int main()
{
<you may add variable declarations here>

srand(static_cast<unsigned>(time(0)));
getProbsPerSet(probsPerSet);
doOneSet('+', probsPerSet);
doOneSet('-', probsPerSet);
doOneSet('*', probsPerSet);
}``````

so far i tried my best with returning just fixed one value which i coded like this
`

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

void getProbsPerSet(int&); // let user choose how many time probs
void doOneSet(char, int); // do one set of each problem
void generateOperands(char&); // declare which calculation it needs

int main() {
int probsPerSet;

getProbsPerSet(probsPerSet);
srand(static_cast<unsigned>(time(0)));
doOneSet('+', probsPerSet);
doOneSet('-', probsPerSet);
doOneSet('*', probsPerSet);

system("pause");
return 0;
}

void   getProbsPerSet(int &Many) {
cout << "Enter problems per set: ";
cin >> Many;
}

void doOneSet(char Function, int Many) {
int i;

if (Function == '+') {
for (i = 0; i < Many; i++) {
First = rand() % 101;
Second = rand() % 101;
cout << First;
generateOperands(Function);
cout << Second << " = ";
}
}
if (Function == '-') {
int set_b;
getProbsPerSet(set_b);
for (i = 0; i < Many; i++) {
First = rand() % 101;
Second = rand() % 101;
cout << First;
generateOperands(Function);
cout << Second << " = ";
}
}
if (Function == '*') {
for (i = 0; i < Many; i++) {
First = rand() % 101;
Second = rand() % 101;
cout << First;
generateOperands(Function);
cout << Second << " = ";
}
}
}

void doOneProblem(int& Ans) {
cin >> Ans;
}

void CalculateCorrectAnswer(int X, int Y, char F, int& A) {
if (F == '+') {
A = X + Y;
}
if (F == '-') {
A = X - Y;
}
if (F == '*') {
A = X * Y;
}
}

void checkAnswer(int Ans, int A) {
if (Ans == A) {
cout << "Correct" << endl;
}
else {
cout << "Incorrect" << endl;
}
}

void generateOperands(char& F) {
cout << " " << F << " ";
}Inline Code Example Here``````

`

but i'm having issue with how can i return each time with other value of 'probsPerSet'?

`void probsPerSet(int& result);` - your initial function.
`void probsPerSet(double& result);` - an alternative function.