forked from hariom20singh/python-learning-codes
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddvolumfrendfunc.cpp
More file actions
Latest commit
52 lines (49 loc) · 963 Bytes
/
Copy pathaddvolumfrendfunc.cpp
File metadata and controls
52 lines (49 loc) · 963 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
#include<String>
usingnamespacestd;
classCuboid;
classSphere
{
private:
int radius;
double volume;
public:
voidAcceptdata()
{
cout << "Enter the radius:";
cin >> radius;
}
voidCalculateVolume()
{
volume = 4 / 3.0 * 3.14 * radius * radius * radius;
}
voidDisplay()
{
cout << "The volume of Sphere is :" << volume << endl;
}
friendvoidAddVolume(Sphere sph, Cuboid cbd);
};
classCuboid
{
private:
int length, breadth, height;
double volume;
public:
voidAcceptData()
{
cout << "Enter the length:";
cin >> length;
cout << "Enter the breadth:";
cin >> breadth;
cout << "Enter the height:";
cin >> height;
}
voidCalculateVolume()
{
volume = length * breadth * height;
}
voidDisplay()
{
cout << "The volume of Sphere is:" << volume << endl;
}
};