-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path62calculator2.cpp
More file actions
43 lines (40 loc) · 1.15 KB
/
62calculator2.cpp
File metadata and controls
43 lines (40 loc) · 1.15 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
#include<iostream>
#include<cmath>
using namespace std;
class simpleC{
float a, b;
public:
void get_data_simple(){
cout<<"Enter the value of a and b:\n";
cin>>a>>b;
}
void performOps_simple(){
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 scientificC{
float a, b;
public:
void get_data_scientific(){
cout<<"Enter the value of a and b:\n";
cin>>a>>b;
}
void performOps_scientific(){
cout<<"The value of cos(a) is "<<cos(a)<<endl;
cout<<"The value of cos(b) is "<<cos(b)<<endl;
cout<<"The value of sin(a) is "<<sin(a)<<endl;
cout<<"The value of sin(b) is "<<sin(b)<<endl;
}
};
class hybridC: public simpleC, public scientificC{};
int main(){
hybridC h;
h.get_data_simple();
h.performOps_simple();
h.get_data_scientific();
h.performOps_scientific();
return 0;
}