blob: 84d143df5270301b4c32b095a40cd53704e60f49 (
plain) (
blame)
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
|
//# include <iostream>
//
//using namespace std;
//using std::.endl;
//
//int main()
//{
//
// float radius, volume, height, pi;
//
// pi = 3.41;
//
// cout << " Figuring out the volume of a cylinder \n" << endl;
//
// cout << " Enter the radius of the cylinder: " << endl;
// cin >> radius;
//
// cout << " Enter the height of the cylinder: " << endl;
// cin >> height;
//
// volume = pi * pow(radius, 2) * height;
//
// cout << " The volume of the cylider is: " << volume << endl;
//
// return 0;
//
//}
#include <iostream>
using std::cout;
using std::cin;
const float PI = 3.14;
int main()
{
float radius, height, volume;
cout << "Welcome to the cylinder volume calculator!\n";
cout << "\nEnter cylinder radius: ";
cin >> radius;
cout << "\nEnter cylinder height: ";
cin >> height;
volume = PI * pow(radius, 2) * height;
cout << "\nThe volume of your cylinder is approximately ";
cout << volume << " cubed units.";
return 0;
}
|