-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInline.cpp
88 lines (75 loc) · 1.86 KB
/
Inline.cpp
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
/**
* \file Inline.cpp
* \brief
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
class Operation
{
public:
void get();
void sum();
void difference();
void product();
void division();
private:
int a, b, add, sub, mul;
float div;
};
//-------------------------------------------------------------------------------------------------
inline void
Operation::get()
{
// std::cout << "Enter first value:";
a = 10;
// std::cout << "Enter second value:";
b = 20;
}
//-------------------------------------------------------------------------------------------------
inline void
Operation::sum()
{
add = a + b;
std::cout << __FUNCTION__ << ": " << add << "\n";
}
//-------------------------------------------------------------------------------------------------
inline void
Operation::difference()
{
sub = a - b;
std::cout << __FUNCTION__ << ": " << sub << "\n";
}
//-------------------------------------------------------------------------------------------------
inline void
Operation::product()
{
mul = a * b;
std::cout << __FUNCTION__ << ": " << mul << "\n";
}
//-------------------------------------------------------------------------------------------------
inline void
Operation::division()
{
div = a / b;
std::cout << __FUNCTION__ << ": "<< div <<"\n" ;
}
//-------------------------------------------------------------------------------------------------
int main(int, char **)
{
Operation s;
s.get();
s.sum();
s.difference();
s.product();
s.division();
return EXIT_SUCCESS;
}
//--------------------------------------------------------------------------------------------------
#if OUTPUT
sum: 30
difference: -10
product: 200
division: 0
#endif