-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut47.cpp
More file actions
58 lines (49 loc) · 1.42 KB
/
Copy pathtut47.cpp
File metadata and controls
58 lines (49 loc) · 1.42 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
#include<iostream>
#include<math.h>
using namespace std;
class SimpleCalculator {
int a, b;
public:
void getDataSimple()
{
cout<<"Enter the value of a"<<endl;
cin>>a;
cout<<"Enter the value of b"<<endl;
cin>>b;
}
void performOperationsSimple(){
cout<<"The value of a + b is: "<<a + b<<endl;
cout<<"The value of a - b is: "<<a - b<<endl;
cout<<"The value of a * b is: "<<a * b<<endl;
cout<<"The value of a / b is: "<<a / b<<endl;
}
};
class ScientificCalculator{
int a, b;
public:
void getDataScientific()
{
cout << "Enter the value of a" << endl;
cin >> a;
cout << "Enter the value of b" << endl;
cin >> b;
}
void performOperationsScientific()
{
cout << "The value of cos(a) is: " << cos(a) << endl;
cout << "The value of sin(a) is: " << sin(a) << endl;
cout << "The value of exp(a) is: " << exp(a) << endl;
cout << "The value of tan(a) is: " << tan(a) << endl;
}
};
class HybridCalculator : public SimpleCalculator, public ScientificCalculator{
};
int main()
{
HybridCalculator calc;
calc.getDataScientific();
calc.performOperationsScientific();
calc.getDataSimple();
calc.performOperationsSimple();
return 0;
}