Formula not Producing Proper Output

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>
#include <cmath>
using namespace std;

double calculate_radius(double radius)
{
	while (radius <=0)
	{
		cout<< radius <<" is not a valid entry for the radius!"<<endl;
		cout<< "Please enter a value greater than 0 for the radius.";
		cin>>radius;
	}
	return radius;
}
double calculate_height(double height)
{
	while (height <=0)
	{
		cout<< height <<" is not a valid entry for the height!"<<endl;
		cout<< "Please enter a value greater than 0 for the height.";
		cin>>height;
	}
	return height;
}

double calculate_volume(double radius, double height, double volume)
{
	
	const double PI = 3.14159;
	volume = PI*pow(radius, 2.0)*height;
	return volume;
}

double calculate_sufacearea(double radius, double height, double surface_area, double PI)
{
	surface_area = 2*PI+2*PI*radius*height;
	return surface_area;
}
int main ()
{
	
	double radius, height, volume, surface_area;
	
	
	
	cout << "Please enter the radius of the cylinder.";
	cin >> radius;
	calculate_radius(radius);
	cout << "Please enter the height of the cylinder.";
	cin >> height;
	calculate_height(height);
	cout << "A cylinder with radius of " << radius  << " and a height of " << height ;
	cout <<" has a volume of " << volume << " and a surface area of " <<surface_area;
	
	
	
}



When this program runs, volume is output at 0 and surface area is 8.69289e-311

any hints?
Topic archived. No new replies allowed.