-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path82.cpp
58 lines (41 loc) · 998 Bytes
/
82.cpp
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 <cmath>
using namespace std;
void fnVol(int);
void fnVol(double);
void fnVol(double, int);
void fnVol(int, int, int);
int main()
{
int iSide, iL, iB, iH;
double dRad;
cout << "\nEnter side length of cube" << endl;
cin >> iSide;
fnVol(iSide);
cout << "\nEnter radius of sphere" << endl;
cin >> dRad;
fnVol(dRad);
cout << "\nEnter side lengths of cuboid" << endl;
cin >> iL >> iB >> iH;
fnVol(iL, iB, iH);
cout << "\nEnter radius and height of cylinder" << endl;
cin >> dRad >> iH;
fnVol(dRad, iH);
return 0;
}
void fnVol(int iS)
{
cout << "\nVolume of Cube is : " << iS*iS*iS << " units." << endl;
}
void fnVol(double dR)
{
cout << "\nVolume of Sphere is : " << 4.0/3.0*M_PI*dR*dR*dR << " units." << endl;
}
void fnVol(double dR, int iH)
{
cout << "\nVolume of Cylinder is : " << M_PI*dR*dR*iH << " units." << endl;
}
void fnVol(int iL, int iB, int iH)
{
cout << "\nVolume of Cuboid is : " << iL*iB*iH << " units." << endl;
}