-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek_10b.cpp
More file actions
38 lines (38 loc) · 846 Bytes
/
week_10b.cpp
File metadata and controls
38 lines (38 loc) · 846 Bytes
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
//week_10b.cpp
#include<iostream>
using namespace std;
class simpleCalc{
public:
int num1,num2;
void fun(){
cout<<"Enter the two numbers\n";
cin>>num1>>num2;
}
};
class Calc: public simpleCalc{
public:
void sum(){
cout<<"The sum of two numbers is "<<num1+num2<<endl;
}
void diff(){
cout<<"The difference of two numbers is "<<num1-num2<<endl;
}
};
class AdvCalc: public simpleCalc{
public:
void product(){
cout<<"The product of two numbers is "<<num1*num2<<endl;
}
void Division(){
cout<<"The division of two numbers is "<<num1/num2<<endl;
}
};
int main(){
AdvCalc obj2;
Calc obj1;
obj1.fun();
obj1.sum();
obj1.diff();
obj2.fun();
obj2.product();
obj2.Division();