-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPRA_25
69 lines (67 loc) · 1.02 KB
/
PRA_25
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
/* A program to demonstrate multilevel inheritance */
#include<iostream>
using namespace std;
class Circle
{
public:
float r;
Circle()
{
cout << "Enter Radius :";
cin >> r;
}
};
class Cylinder: public Circle
{
public:
float h;
Cylinder()
{
cout << "Enter Height :";
cin >> h;
}
};
class Cone:public Cylinder
{
public:
float l;
Cone()
{
cout << "Enter Slant Height :";
cin >> l;
}
};
class Area: public Cone
{
double cir_a;
double cyl_a;
double con_a;
public:
Area()
{
cir_a=3.14*r*r;
cyl_a=2*(cir_a+(3.14*r*h));
con_a=cir_a+(3.14*r*l);
cout <<endl;
cout <<"Area of Circle : "<< cir_a<<endl;
cout <<"Area of Cylinder : "<< cyl_a<<endl;
cout <<"Area of Cone : "<< con_a<<endl;
}
};
int main()
{
Area obj1;
return 0;
}
/*
Output:
Enter Radius :5
Enter Height :7
Enter Slant Height :8
Area of Circle : 78.5
Area of Cylinder : 376.8
Area of Cone : 204.1
--------------------------------
Process exited after 11.05 seconds with return value 0
Press any key to continue . . .
*/