Hey I need help with the math tutor. I need to be able to print out if the answer is right or not . Also let the user enter the number of math problems per set and what the max number will be for the set. If you could please help me I would love it. Thank you
//
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <ctime>
#include <string>
using namespace std;
void doOneSet(char symbol, int probsPerSet);
void getProbsPerSet(int probsPerSet);
void CheckAnswer(char symbol, int answer);
int main()
{
int set;
srand(time(0));
getProbsPerSet(set);
doOneSet('+', set);
doOneSet('-', set);
doOneSet('*', set);
// printReport(<arguments>);
system("pause");
return 0;
}
void CheckAnswer(char symbol, int answer){
int myAnswer = rand() % 101 + rand () % 101;
if(myAnswer == answer)
cout << "correct";
else
cout << "incorrect";
}
void getProbsPerSet(int probsPerSet)
{
int count;
cout << "Enter problems per set: " << endl;
cin >> probsPerSet;
}
void doOneSet( char symbol, int probsPerSet )
{
int answer;
int num1;
int maxNum;
for (int i = 0; i < 100; i++){
cout << setw(8); num1 = rand() % 101;
//if (i % 5 == 4){
cout << "Set #1" << endl;
cout << "-----------" << endl;
if(maxNum <= 0 )
cout << " What is the maximum number for this set?" << endl;
cin >> maxNum;
cout << rand() % 101 << "+"<< rand () % 101 << "=" <<endl;
cin >> answer;
CheckAnswer(symbol, answer) ;
cout << "Set #2" << endl;
cout << "----------" << endl;
cout << " What is the maximum number for this set?" << maxNum << endl;
cout << rand () % 101 << "-" << rand() % 101 << "="<< endl;
cin >> answer;
CheckAnswer(symbol, answer);
cout << "Set #3" << endl;
cout <<" ------------" << endl;
cout << " What is the maximum number for this set?" << maxNum << endl;
cout << rand () % 101 << "*" << rand() % 101 << "="<< endl;
cin >> answer;
CheckAnswer(symbol, answer);
}
}