hi, guys i'm in colleage trying to do some homework with cs10 and got stuck with this combination of functions please help me out!!!! T^T spent 8hours today still couldn't figure it out
#include<iostream>
using namespace std;
void getProbsPerSet();
void doOneset(char Func);
void doOneproblem(int &Answer);
void getMaxnumber(int &MAX);
void printHeader(int &First, int &Sec, char Func);
void calculateCorrectAnswer(int First, int Sec, char Func, int &Cor);
void checkAnswer(int Ans, int Cor);
int main()
{
char Func;
//srand(static_cast<unsigned>(time(0))); <<Not sure what this is suppose to do with
doOneset('+');
doOneset('-');
doOneset('*');
system("pause");
return 0;
}
void doOneset(char Func) {
getProbsPerSet() { // keep saying expected ';' not sure why
printHeader(&First, &Sec, Func); // all of line 27 - 30 they can't declared not sure how to fix this
doOneproblem(&Ans);
getMaxnumber(&Max);
checkAnswer(Ans, Cor);
}
}
void getProbsPerSet() {
int i;
for (i = 0; i < 5; i++) {
doOneset(Func);
}
}
void doOneproblem(int &Ans) {
cin >> Ans;
cout << endl;
}
void printHeader(int &First, int &Sec, char Func) {
}
void getMaxnumber(int First, int Sec, char Func, int &Max) {
if (Func == '+') {
Max = First + Sec;
}
if (Func == '-') {
Max = First - Sec;
}
if (Func == '*') {
Max = First * Sec;
}
}
void calculateCorrectAnswer(int First, int Sec, char Func, int &Cor) {
if (Func == '+') {
Cor = First + Sec;
}
if (Func == '-') {
Cor = First - Sec;
}
if (Func == '*') {
Cor = First * Sec;
}
}
void checkAnswer(int Ans, int Cor) {
if (Ans == Cor) {
cout << "Correct" << endl;
}
else {
cout << "Incorrect" << endl;
}
}
The Picture is description what my professor asking for this homework and the result should looks like
https://static.daniweb.com/attachments/4/98451002acfbfaf45749aa67e0b28cff.jpg
45 + 21 = 66
correct
0 + 100 = 100
correct
54 + 23 = 67
incorrect
4 + 19 = 13
incorrect
18 + 92 = 100
correct
59 - 19 = 40
correct
19 - 84 = -29
incorrect
0 - 65 = -65
correct
96 - 1 = 95
correct
94 - 14 = 80
correct
0 * 87 = 0
correct
45 * 84 = 398
incorrect
8 * 37 = 873
incorrect
34 * 83 = 831
incorrect
38 * 3 = 238
incorrect
this. I already programed without using functions it worked fine but i tried separate with these functions having so much trouble with please help me out!!! THANKS