-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
65 lines (61 loc) · 1.43 KB
/
example.cpp
File metadata and controls
65 lines (61 loc) · 1.43 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
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <cmath>
using namespace std;
class simpleCalculator
{
int a, b;
public:
void getdata()
{
cout << "Enter the value of a" << endl;
cin >> a;
cout << "Enter the value of b" << endl;
cin >> b;
}
void performOperation()
{
cout << "Addition of two number is="
<< a + b << endl;
cout << "Subtraction of two number is="
<< a - b << endl;
cout << "Multiplication of two number is="
<< a * b << endl;
cout << "Division of two number is="
<< a / b << endl;
}
};
class scientificCalculator
{
int a, b;
public:
void getdata2()
{
cout << "Enter the value of a" << endl;
cin >> a;
cout << "Enter the value of b" << endl;
cin >> b;
}
void performOperation2()
{
cout << "the cos of a is="
<< cos(a) << endl;
cout << "Sin of a is="
<< sin(a) << endl;
cout << "The tan of a is="
<< tan(a) << endl;
cout << "The square root of a is = "
<< sqrt(a) << endl;
}
};
class HybridCalculator : public simpleCalculator,public scientificCalculator
{
};
int main()
{
HybridCalculator cal;
cal.getdata();
cal.performOperation();
cal.getdata2();
cal.performOperation2();
return 0;
}