Urgent! Math quiz assignment

Hi, I need help soooooooooo bad, I asked my boyfriend but he can't seem to figure it out ether. I have a final project for programming class due soon and I just can't figure out what I need to do to finish this could someone who's decent with c please just help me do this quick I would appreciate it a ton. Here's what the assignment is and what I have so far.

If you choose this path you will develop a math tutor for grades k - 3 & 4 - 6 (need to understand levels of math skills for each of these levels). This will be a fully functional application that will run as long as the user wants it to run asking them to answer a randomly generated math problem. They must be able to select their level and whether they want to practice - addition, subtraction, multiplication, or division (make sure the program does not allow division by zero! You must keep track of their statistics providing them with a complete report of how well they did after each round - have the program comment on their correctness or incorrectness giving them at least 6 tries before giving them the correct answer. Provide encouraging comments throughout the program (funny is acceptable ).

Inputs - user name, user level, user enters which equation type they want to practice,
program should generate the problem based on user entry, display correct or incorrect responses, and allow the user to continue or stop

Outputs - user statistics ( nice report format) after each round, encouraging comments throughout program execution, and final game comments



//////////////////
K, that's what the assignment is, and here's what I have so far...

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

// variables /////////////////////////////////////////////////////////////////////

int grade = 0;
int mathtype;
string name;


// START ////////////////////////////////////////////////////////////////////
cout <<" WELCOME TO KATIES MATHTEST!!!"<<endl<<endl<<endl;
cout <<"Please enter your name: "<<endl;
cin >> name;
cout <<"and what grade are you in?"<<endl;
cin >>grade;


// Now I need to make an if so it will know which grade to go into///////


if (grade <4)
{
cout <<"You've selected grades k-3, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}


else
{
cout <<"You've selected grades 4-6, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}

if (mathtype = 1)
(
cout<<"You chose Addition"<<endl;
)

if (mathtyp = 2)
(
cout<<"You chose Division"<<endl;
)

if (mathtyp = 3)
(
cout<<"You chose Multiplication"<<endl;
)

if (mathtyp = 4)
(
cout<<"You chose Subtraction"<<endl;
)



system("PAUSE");
return EXIT_SUCCESS;
}
You confused the assignment operator (=) with the equality comparison operator (==).
To generate random numbers for the math problems, you can use rand(). See here:
http://www.cplusplus.com/reference/clibrary/cstdlib/rand/

No one will do the full assignment, but if you have specific questions, you can just ask.
k, I fixed the ==, I'm getting an error on the part "cout<<"You chose Addition"<<endl;". I guess I'm just not sure of what route to take next to get the assignment done I'm freakin out.
What is the error exactly?
closed account (3hM2Nwbp)
It might be the text formatting...but some of your brackets '{' / '}' appear to be parentheses '(' / ')'

if(...)
(

)

should be

if(...)
{

}
Yep that's what it was. K so now it runs up to the part where you can choose which grade your in and what math type you want to do. What I need to do now I think is figure out how to make it ask 5 random math questions for each type. I think I would do that by making it randomly generate 2 variables and then doing addition or whatever they choose to them. How would I do that and make it so that they have 6 guesses at it before moving on? I think I would make a while loop but I'm not sure, here's the code that I have now corrected it should run.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

// variables /////////////////////////////////////////////////////////////////////

int grade = 0;
int mathtype;
string name;


// START ////////////////////////////////////////////////////////////////////
cout <<" WELCOME TO Katies MATHTEST!!!"<<endl<<endl<<endl;
cout <<"Please enter your name: "<<endl;
cin >> name;
cout <<"and what grade are you in?"<<endl;
cin >>grade;


// Now I need to make an if so it will know which grade to go into///////


if (grade <4)
{
cout <<"You've selected grades k-3, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}


else
{
cout <<"You've selected grades 4-6, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}

if (mathtype == 1)
{
cout<<"You chose Addition"<<endl;
}

if (mathtype == 2)
{
cout<<"You chose Division"<<endl;
}

if (mathtype == 3)
{
cout<<"You chose Multiplication"<<endl;
}

if (mathtype == 4)
{
cout<<"You chose Subtraction"<<endl;
}



system("PAUSE");
return EXIT_SUCCESS;
}
Well the main thing you need to do is format the question your going to ask with some variables that get filled in when the program runs.

Best way to that is with rand().
You would need to make an integer, named something (in this case lets call it x).
So x needs a random value. So we call rand() to fill it.

int x = rand();

So now x = some integer number. What is it? I don't know. Only the computer and the compiler will know. So I just have to say please put whatever this value is at runtime in this place. with cout it looks sort of like this:

cout << "What is " << x << " + " << y << "?" << endl;

Then you need to get the users input and see if it is equal to the actual addition(subtraction/division/multiplication) of x and y.

1
2
3
4
5
6
7
8
9
cin >> user;
if (user == (X+y))
{
// execute code on correct answer.
}
else
{
// execute code on wrong answer.
}


Does that help? You may want to modulo (%) the rand() function since it can produce some large numbers bigger than most k-6 graders do for multiplication and division.

For looping you will most likely use a while loop but any loop will work.
You'll need to loop to 6 right? So you'll need a counter, and probably also need a condition in the loop to leave early if they guess right and a condition if they fail to guess by guess 6.
K, I tried to make the random thing but I keep getting an error up top saying "gone does not name a type", not sure what it is, I probly did the random function off but I'm not sure. Here's what I've got though.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

// variables /////////////////////////////////////////////////////////////////////

int grade = 0;
int mathtype;
string name;
int gone rand();
int gtwo rand();
int answer;
int guess;


// START ////////////////////////////////////////////////////////////////////
cout <<" WELCOME TO Katies MATHTEST!!!"<<endl<<endl<<endl;
cout <<"Please enter your name: "<<endl;
cin >> name;
cout <<"and what grade are you in?"<<endl;
cin >>grade;


// Now I need to make an if so it will know which grade to go into///////


if (grade <4)
{
cout <<"You've selected grades k-3, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}


else
{
cout <<"You've selected grades 4-6, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////
////////////
////

if (mathtype == 1)
{


cout<<"You chose Addition, here's question 1 of 5"<<endl;
x + y = answer;
cout<<"What is "<<gone<<"plus "<<gtwo<<endl;
cin>>guess;

if (guess == answer)
{
cout<<"That's right!"<<endl;
}

else
{
cout<<"Sorry that's not right, please guess again"<<endl;
}

}







if (mathtype == 2)
{
cout<<"You chose Division"<<endl;
}

if (mathtype == 3)
{
cout<<"You chose Multiplication"<<endl;
}

if (mathtype == 4)
{
cout<<"You chose Subtraction"<<endl;
}



system("PAUSE");
return EXIT_SUCCESS;
}
rand() is a function that returns a value. You do remember how to use the assignment operator?
Also there's an error with the line x + y = answer. Its a pretty big error.
Na that's my best attempt at this I need help real bad. like how should I fix this I'm not sure
This is how it now looks btw, no x and y I made those gone and gtwo.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

// variables /////////////////////////////////////////////////////////////////////

int grade = 0;
int mathtype;
string name;
int gone rand();
int gtwo rand();
int answer;
int guess;


// START ////////////////////////////////////////////////////////////////////
cout <<" WELCOME TO Katies MATHTEST!!!"<<endl<<endl<<endl;
cout <<"Please enter your name: "<<endl;
cin >> name;
cout <<"and what grade are you in?"<<endl;
cin >>grade;


// Now I need to make an if so it will know which grade to go into///////


if (grade <4)
{
cout <<"You've selected grades k-3, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}


else
{
cout <<"You've selected grades 4-6, what would you like to work on?"<<endl;
cout <<endl<<endl<<endl<<"Addition Division Multiplication Subtraction"<<endl;
cout << " 1 2 3 4 "<<endl<<endl<<endl;

cin >> mathtype;
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////
////////////
////

if (mathtype == 1)
{


cout<<"You chose Addition, here's question 1 of 5"<<endl;
gone + gtwo = answer;
cout<<"What is "<<gone<<"plus "<<gtwo<<endl;
cin>>guess;

if (guess == answer)
{
cout<<"That's right!"<<endl;
}

else
{
cout<<"Sorry that's not right, please guess again"<<endl;
}

}







if (mathtype == 2)
{
cout<<"You chose Division"<<endl;
}

if (mathtype == 3)
{
cout<<"You chose Multiplication"<<endl;
}

if (mathtype == 4)
{
cout<<"You chose Subtraction"<<endl;
}



system("PAUSE");
return EXIT_SUCCESS;
}
Anyone? Idk what to do on this.
I thought that searching and fixing problems in your code would take longer, so redid the program from scratch. It should meet the requirements now.
Output is done with stdio.h -> printf().
You can convert it to <iostream>... if you have nothing better to do.
Documentation about commands used can be found on this site.
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#include <cstdlib>
#include <stdio.h>
#include <time.h>
#define title "MathTest"
#define quests 9 // questions in one game\set
#define miss 6 // wrong answers allowed before gameover
//Addition test params (number range): 
#define add_min 1
#define add_max 9
//Subtraction test params (number range): 
#define sub_min 1
#define sub_max 9
//Multiplication test params (number range): 
#define mul_min 2
#define mul_max 9
//Division test params (number range): 
#define div_min 2
#define div_max 9
char uname[16]; // users name
int key = -1; // for main menu, keyboard input
int one, two, sol; // variables for test
int i, q;
int tries; // tries left (to give right answer)
//statistics:
int st_right, st_wrong, st_total, st_questions;
int sl_right, sl_wrong, sl_total;
bool solved, playing; // booleans

int random(int min, int max) //returns random in range min..max
{
    return rand() % (max - min + 1) + min;
}
int random(int max) //returns a random in range 1..max
{
    return rand() % max + 1;
}

void comment(char con) // returns a random comment\taunt for a specified situation
{
    if (con == '~') // wrong answer
    {
        switch (random(3))
        {
        case 1: printf("Wrong answer (>_<)"); break;
        case 2: printf("You should try again."); break;
        case 3: printf("Be carefull."); break;
        }
    }
    if (con == '@') // lost
    {
        switch (random(3))
        {
        case 1: printf("You lost the game (;_;)"); break;
        case 2: printf("Game over."); break;
        case 3: printf("How could you let this happen? (T_T)"); break;
        }
    }
    if (con == '!') // right answer
    {
        printf("Right!");
        // todo: add a switch statement here
    }
    if (con == 'v')
    {
        printf("Victory!");
        // todo: add a switch statement here
    }
    if (con == '<') // lower!
    {
        printf("Try smaller number.");
        // todo: add a switch statement here
    }
    if (con == '>') // higher!
    {
        printf("Try higher number.");
        // todo: add a switch statement here
    }
    if (con == '+') // just a bit higher
    {
        printf("A bit higher...");
        // todo: add a switch statement here
    }
    if (con == '-') // just a bit lower
    {
        printf("A bit lower...");
        // todo: add a switch statement here
    }
}

void stats() // displays global statistics
{
    printf("\n\t***Game statistics***\n");
    printf("\tTotal questions: %d\n", st_questions);
    printf("\tTotal answers: %d\n", st_total);
    printf("\tRight answers: %d\n", st_right);
    printf("\tWrong answers: %d\n", st_wrong);
    if (st_total != 0)printf("\tAccuracy: %d%c\n", st_right * 100 / st_total, '%');
}

void stats_local() // displays local statistics
{
    printf("\n\t***Round statistics***\n");
    printf("\tRound result: ");
    if (playing) printf("Victory\n"); else printf("Defeat\n");
    printf("\tTotal questions: %d\n", q);
    printf("\tTotal answers: %d\n", sl_total);
    printf("\tRight answers: %d\n", sl_right);
    printf("\tWrong answers: %d\n", sl_wrong);
    printf("\tAccuracy: %d%c\n", sl_right * 100 / sl_total, '%');
}

void test(char type) // test\game function.
{
    sl_right = 0; sl_wrong = 0; sl_total = 0;
    playing = true;
    for (q = 1; q <= quests && playing; q++)
    {
        tries = miss;
        solved = false;
        //Generate math problem
        if (type == '+')
        {
            one = random(add_min, add_max);
            two = random(add_min, add_max);
            sol = one + two;
            printf("\n%d. %d + %d = ?\n", q, one, two);
        }
        if (type == '-')
        {
            sol = random(sub_min, sub_max);
            two = random(sub_min, sub_max);
            one = sol + two;
            printf("\n%d. %d - %d = ?\n", q, one, two);
        }
        if (type == '/')
        {
            sol = random(div_min, div_max);
            two = random(div_min, div_max);
            one = sol * two;
            printf("\n%d. %d / %d = ?\n", q, one, two);
        }
        if (type == '*')
        {
            one = random(mul_min, mul_max);
            two = random(mul_min, mul_max);
            sol = one * two;
            printf("\n\n%d. %d * %d = ?\n", q, one, two);
        }
        //Answering loop
        while (tries > 0 && !solved)
        {
            //Get the answer from user
            printf("   Your answer > "); scanf("%d", &i);
            sl_total++;
            if (i == sol) // right answer
            {
                sl_right++;
                comment('!');
                solved = true;
            }
            else // wrong answer
            {
                sl_wrong++;
                tries--;
                if (tries > 0)
                {
                    // Provide different comments, depending on how near the answer was.
                    if (i < sol + 4 && i > sol) comment('-');
                    else if (i > sol - 4 && i < sol) comment('+');
                    else if (i < sol + 16 && i > sol) comment('<');
                    else if (i > sol - 16 && i < sol) comment('>');
                    else comment('~');
                    printf("\nYou have %d tries remaining!\n", tries);
                }
                else // no tries\lives remaining - game over
                {
                    solved = true;
                    playing = false;
                    comment('@');
                    printf("\nThe correct answer was... %d!", sol);
                }
            }
        }
    }
    q--; // decrease q by one to hold actual number of passed questions
    st_questions += q;
    st_total += sl_total;
    st_right += sl_right;
    st_wrong += sl_wrong;
    if (playing) comment('v');
    stats_local();
}
int main()
{
    srand(time(NULL)); // set random seed from current time
    //Get users name:
    printf("What is your name?\n > "); gets(uname);
    while (1) // main loop:
    {
        printf("\n\n");
        printf("Welcome, %s, to %s!\n", uname, title);
        printf("Please choose one of the following options: \n");
        printf(" [1] Addition\n");
        printf(" [2] Subtraction\n");
        printf(" [3] Division\n");
        printf(" [4] Multiplication\n");
        printf(" [5] Statistics\n");
        printf(" [0] Exit\n");
        //Get input:
        printf(" > "); scanf("%d", &key);
        //Cases:
        if (key == 1) test('+');
        if (key == 2) test('-');
        if (key == 3) test('/');
        if (key == 4) test('*');
        if (key == 5) stats();
        if (key == 0) return 1;
    }
    return 0;
}
Wo, thanks soooo much I really did just want help but yours seems to work alot more efficiently. How come some of your stuff is diffrent though, is there a way to convert this into mine? I have devc++ and we use cout>> and stuff like that. Thanks again this is due in the morning your a life saver : )
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
#define title "MathTest"
#define quests 9 // questions in one game\set
#define miss 6 // wrong answers allowed before gameover
//Addition test params (number range): 
#define add_min 1
#define add_max 9
//Subtraction test params (number range): 
#define sub_min 1
#define sub_max 9
//Multiplication test params (number range): 
#define mul_min 2
#define mul_max 9
//Division test params (number range): 
#define div_min 2
#define div_max 9
char uname[16]; // users name
int key = -1; // for main menu, keyboard input
int one, two, sol; // variables for test
int i, q;
int tries; // tries left (to give right answer)
//statistics:
int st_right, st_wrong, st_total, st_questions;
int sl_right, sl_wrong, sl_total;
bool solved, playing; // booleans

int random(int min, int max) //returns random in range min..max
{
    return rand() % (max - min + 1) + min;
}
int random(int max) //returns a random in range 1..max
{
    return rand() % max + 1;
}

void comment(char con) // returns a random comment\taunt for a specified situation
{
    if (con == '~') // wrong answer
    {
        switch (random(3))
        {
        case 1: cout << "Wrong answer (>_<)"; break;
        case 2: cout << "You should try again."; break;
        case 3: cout << "Be carefull."; break;
        }
    }
    if (con == '@') // lost
    {
        switch (random(3))
        {
        case 1: cout << "You lost the game (;_;)"; break;
        case 2: cout << "Game over."; break;
        case 3: cout << "How could you let this happen? (T_T)"; break;
        }
    }
    if (con == '!') // right answer
    {
        cout << "Right!";
        // todo: add a switch statement here
    }
    if (con == 'v')
    {
        cout << "Victory!";
        // todo: add a switch statement here
    }
    if (con == '<') // lower!
    {
        cout << "Try smaller number.";
        // todo: add a switch statement here
    }
    if (con == '>') // higher!
    {
        cout << "Try higher number.";
        // todo: add a switch statement here
    }
    if (con == '+') // just a bit higher
    {
        cout << "A bit higher...";
        // todo: add a switch statement here
    }
    if (con == '-') // just a bit lower
    {
        cout << "A bit lower...";
        // todo: add a switch statement here
    }
}

void stats() // displays global statistics
{
    cout << endl << "\t***Game statistics***" << endl;
    cout << "\tTotal questions: " << st_questions << endl;
    cout << "\tTotal answers: " << st_total << endl;
    cout << "\tRight answers: " << st_right << endl;
    cout << "\tWrong answers: " << st_wrong << endl;
    if (st_total != 0)cout << "\tAccuracy: " << st_right * 100 / st_total << '%' << endl;
}

void stats_local() // displays local statistics
{
    cout << endl << "\t***Round statistics***" << endl;
    cout << "\tRound result: ";
    if (playing) cout << "Victory" << endl; else cout << "Defeat" << endl;
    cout << "\tTotal questions: " << q << endl;
    cout << "\tTotal answers: " << sl_total << endl;
    cout << "\tRight answers: " << sl_right << endl;
    cout << "\tWrong answers: " << sl_wrong << endl;
    cout << "\tAccuracy: " << sl_right * 100 / sl_total << '%' << endl;
}

void test(char type) // test\game function.
{
    sl_right = 0; sl_wrong = 0; sl_total = 0; playing = true;
    for (q = 1; q <= quests && playing; q++)
    {
        tries = miss;
        solved = false;
        //Generate math problem
        if (type == '+')
        {
            one = random(add_min, add_max);
            two = random(add_min, add_max);
            sol = one + two;
            cout << endl << q << ". " << one << " + " << two << " = ?" << endl;
        }
        if (type == '-')
        {
            sol = random(sub_min, sub_max);
            two = random(sub_min, sub_max);
            one = sol + two;
            cout << endl << q << ". " << one << " - " << two << " = ?" << endl;
        }
        if (type == '/')
        {
            sol = random(div_min, div_max);
            two = random(div_min, div_max);
            one = sol * two;
            cout << endl << q << ". " << one << " / " << two << " = ?" << endl;
        }
        if (type == '*')
        {
            one = random(mul_min, mul_max);
            two = random(mul_min, mul_max);
            sol = one * two;
            cout << endl << q << ". " << one << " * " << two << " = ?" << endl;
        }
        //Answering loop
        while (tries > 0 && !solved)
        {
            //Get the answer from user
            cout << "   Your answer > "; cin >> i;
            sl_total++;
            if (i == sol) // right answer
            {
                sl_right++;
                comment('!');
                solved = true;
            }
            else // wrong answer
            {
                sl_wrong++;
                tries--;
                if (tries > 0)
                {
                    // Provide different comments, depending on how near the answer was.
                    if (i < sol + 4 && i > sol) comment('-');
                    else if (i > sol - 4 && i < sol) comment('+');
                    else if (i < sol + 16 && i > sol) comment('<');
                    else if (i > sol - 16 && i < sol) comment('>');
                    else comment('~');
                    cout << endl << "You have " << tries << " tries remaining!" << endl;
                }
                else // no tries\lives remaining - game over
                {
                    solved = true;
                    playing = false;
                    comment('@');
                    cout << endl << "The correct answer was... " << sol << "!";
                }
            }
        }
    }
    q--; // decrease q by one to hold actual number of passed questions
    st_questions += q;
    st_total += sl_total;
    st_right += sl_right;
    st_wrong += sl_wrong;
    if (playing) comment('v');
    stats_local();
}
int main()
{
    srand(time(NULL)); // set random seed from current time
    //Get users name:
    cout << "What is your name?" << endl << " > "; cin >> uname;
    while (1) // main loop:
    {
        cout << endl << endl;
        cout << "Welcome, " << uname << ", to " << title << "!" << endl;
        cout << "Please choose one of the following options:" << endl;
        cout << " [1] Addition" << endl;
        cout << " [2] Subtraction" << endl;
        cout << " [3] Division" << endl;
        cout << " [4] Multiplication" << endl;
        cout << " [5] Statistics" << endl;
        cout << " [0] Exit" << endl;
        //Get input:
        cout << " > "; cin >> key;
        //Cases:
        if (key == 1) test('+');
        if (key == 2) test('-');
        if (key == 3) test('/');
        if (key == 4) test('*');
        if (key == 5) stats();
        if (key == 0) return 1;
    }
    return 0;
}
<iostream> variation, took exactly 20 minutes to do.
Topic archived. No new replies allowed.