-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperations.cpp
More file actions
53 lines (45 loc) · 1.11 KB
/
operations.cpp
File metadata and controls
53 lines (45 loc) · 1.11 KB
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
#include <iostream>
using namespace std;
class operation{
int a, b, c, addition, subtraction, multiplication;
float division;
public:
void get();
void add();
void subtract();
void multiply();
void divide();
};
inline void operation :: get(){
cout << "Enter value 1: ";
cin >> a;
cout << "Enter value 2: ";
cin >> b;
cout << "Enter value 3: ";
cin >> c;
}
inline void operation :: add(){
addition = a + b + c;
cout << "The addition of all numbers is: " << a + b + c << endl;
}
inline void operation :: subtract(){
subtraction = a - b - c;
cout << "The subtraction of all numbers is: " << a - b - c << endl;
}
inline void operation :: multiply(){
multiplication = a * b * c;
cout << "The subtraction of all numbers is: " << a * b * c << endl;
}
inline void operation :: divide(){
division = a / b / c;
cout << "The division of all numbers is: " << division << endl;
}
int main(){
cout << "This is a program that uses inline functions" << endl;
operation s;
s.get();
s.add();
s.subtract();
s.multiply();
s.divide();
}