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 doOneProblem(int&); // ask user the answer
void checkAnswer(int, int); // compare the answer if it's right
void generateOperands(char&); // declare which calculation it needs
void CalculateCorrectAnswer(int, int, char, int&); // Find correct answer

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++) {
            int First, Second, Answer, Final;
            First = rand() % 101;
            Second = rand() % 101;
            cout << First;
            generateOperands(Function);
            cout << Second << " = ";
            doOneProblem(Answer);
            CalculateCorrectAnswer(First, Second, Function, Final);
            checkAnswer(Answer, Final);
        }
    }
    if (Function == '-') {
        int set_b;
        getProbsPerSet(set_b);
        for (i = 0; i < Many; i++) {
            int First, Second, Answer, Final;
            First = rand() % 101;
            Second = rand() % 101;
            cout << First;
            generateOperands(Function);
            cout << Second << " = ";
            doOneProblem(Answer);
            CalculateCorrectAnswer(First, Second, Function, Final);
            checkAnswer(Answer, Final);
        }
    }
    if (Function == '*') {
        for (i = 0; i < Many; i++) {
            int First, Second, Answer, Final;
            First = rand() % 101;
            Second = rand() % 101;
            cout << First;
            generateOperands(Function);
            cout << Second << " = ";
            doOneProblem(Answer);
            CalculateCorrectAnswer(First, Second, Function, Final);
            checkAnswer(Answer, Final);
        }
    }
}

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'?

please help me out!!!

Solved !!!

Ok. Show work! At least the function 'probsPerSet' has an argument signature that you can mutate to get different return types, such as:
void probsPerSet(int& result); - your initial function.
void probsPerSet(double& result); - an alternative function.
etc.
The compiler will happily sort these out for you, so if you pass a variable of the correct type (int or double) to the function, the proper function will be called. How does it do this? With something called 'name mangling'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.