-
Notifications
You must be signed in to change notification settings - Fork 2
/
42.cpp
87 lines (81 loc) · 1.58 KB
/
42.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
#include <iostream>
#include <cmath>
using namespace std;
class simple
{
protected:
int a, b;
int opr;
public:
void get(int x, int y)
{
a = x;
b = y;
}
void operation()
{
cout << "enter the operation" << endl
<< "1 for sum"
<< endl
<< "2 for subtract" << endl
<< "3 for multiply" << endl
<< "4 for division" << endl;
cin >> opr;
switch (opr)
{
case 1:
cout << "the sum is" << a + b;
case 2:
cout << "the difference is" << a - b;
case 3:
cout << "the multiplication is" << a * b;
case 4:
cout << "the division is" << float(a / b);
}
}
};
class scientific
{
protected:
int a, b;
int opr;
public:
void get(int x, int y)
{
a = x;
b = y;
}
void operations()
{
cout << "enter the operation" << endl
<< "5 for sine "
<< endl
<< "6 for cos" << endl
<< "7 for tan" << endl
<< "8 for expo" << endl;
cin >> opr;
switch (opr)
{
case 5:
cout << "the sine is" << sin(a);
case 6:
cout << "the cos is" << cos(a);
case 7:
cout << "the tan is" << tan(a);
case 8:
cout << "the expo is" << exp(a);
}
}
};
class hybrid : public simple, public scientific
{
public:
int a ,b;
};
int main()
{
hybrid my;
my.get(4,4);
my.operation();
return 0;
}