Help me...

I began my college information system.
I'm attending a substance called Data Structure.
It was after a year in which my professor asked the following theme: Build a program that reads two numbers and one of the four mathematical operations. The program should display the result of the operation informed.
It is required to use the functions and procedures.

I am a beginner and any help is welcome ...
I'm unsure of what you are asking exactly. I wrote this for you. Maybe it can give you a good foundation?

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
#include <iostream>

using namespace std;

int add(int, int);
int sub(int, int);
int division(int, int);
int mult(int, int);

int main()
{
int numOne, numTwo, choice;


cout << "Enter 2 numbers:\t";
cin >> numOne >> numTwo;

cout << endl << "Enter 1 for addition, 2 for subtraction, 3 for division, or 4 for multimplication:\t";
cin >> choice;
cout << endl;

switch(choice)
{
case 1:
cout << add(numOne, numTwo) << endl;
break;
case 2:
cout << sub(numOne, numTwo) << endl;
break;
case 3:
cout << division(numOne, numTwo) << endl;
break;
case 4:
cout << mult(numOne, numTwo) << endl;
break;
default:
cout << "That is an invalid choice" << endl;
}

system("pause");     // may not need this
return 0;

}  // end int main()

int add(int x, int y)
{
return x+y;
}

int sub(int x, int y)
{
return  x - y;
}

int division(int x, int y)
{
return x/y;
}

int mult(int x, int y)
{
return x * y;
}

Topic archived. No new replies allowed.