Program to compute surface area help!

So im writing a program, using functions, that will solve total surface area, lateral surface area and volume of a cylinder given Radius(r) and Height (h). When I go to build I keep getting an error saying an identifier not found. Can anyone send me in the right direction??

#include <iostream>
#include <cmath>
#include <cassert>
#include <cctype>
#include <conio.h>
using namespace std;
double root1 (double r, double h);
double root2 (double r, double h);
double root3 (double r, double h);
int main()
{

//Listing variable values
double r,h;



// Stating first functions of roots
cout<< "Compute surface area, Lateral surface area and Volume, Given Radius and Height of a cylinder:" <<endl;
cout<< "Please imput a value for Radius 'r' and a value for Height 'h':" <<endl;

//inputting these values
cin >> r >> h ;

double surfacearea= eq1 (r,h);
double lateralarea= eq2 (r,h);
double volume= eq3 (r,h);
cout<<"\n The total surface area of the cylinder is:"<<surfacearea<<endl;
cout<<"\n The lateral surface area of the cylinder is:"<<lateralarea<<endl;
cout<<"\n The volume of the whole cylinder is:"<<volume<<endl;


getch();
}
const double PI = 3.14159;
//Equation to give Total Surface Area
double eq1 (double r, double h)
{double answer= (2 * PI * r)*( r + h);
return answer;

}
//Equation to give Lateral Surface Area
double eq2 (double r, double h)
{double answer= (2 * PI * r * h);
return answer;
}

//Equation to give Volume of the cylinder
double eq3 (double r, double h)
{double answer= (PI * pow(r, 2.0) * h);
return answer;

}
Consider this


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


#include <iostream>
#include <cmath>
#include <cassert>
#include <cctype>
#include <conio.h>
using namespace std;
double root1 (double r, double h); // see what is this ? change this root1 with eq1 
double root2 (double r, double h);// same here root2 with eq2
double root3 (double r, double h);// again root3 with eq3
int main()
{

//Listing variable values
double r,h;



// Stating first functions of roots
cout<< "Compute surface area, Lateral surface area and Volume, Given Radius and Height of a cylinder:" <<endl;
cout<< "Please imput a value for Radius 'r' and a value for Height 'h':" <<endl;

//inputting these values
cin >> r >> h ;

double surfacearea= eq1 (r,h);
double lateralarea= eq2 (r,h);
double volume= eq3 (r,h);
cout<<"\n The total surface area of the cylinder is:"<<surfacearea<<endl;
cout<<"\n The lateral surface area of the cylinder is:"<<lateralarea<<endl;
cout<<"\n The volume of the whole cylinder is:"<<volume<<endl;


getch();
}
const double PI = 3.14159;
//Equation to give Total Surface Area
double eq1 (double r, double h)
{double answer= (2 * PI * r)*( r + h);
return answer;

}
//Equation to give Lateral Surface Area
double eq2 (double r, double h)
{double answer= (2 * PI * r * h);
return answer;
}

//Equation to give Volume of the cylinder
double eq3 (double r, double h)
{double answer= (PI * pow(r, 2.0) * h);
return answer;

} 




this should be your code

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
#include <iostream>
#include <cmath>
#include <cassert>
#include <cctype>
#include <conio.h>
using namespace std;

	double eq1 (double r,double h);
	double eq2 (double r,double h);
	double eq3 (double r,double h);
int main()
{
	
//Listing variable values
double r,h;



// Stating first functions of roots
cout<< "Compute surface area, Lateral surface area and Volume, Given Radius and Height of a cylinder:" <<endl;
cout<< "Please imput a value for Radius 'r' and a value for Height 'h':" <<endl;

//inputting these values
cin >> r >> h ;

double surfacearea= eq1 (r,h);
double lateralarea= eq2 (r,h);
double volume= eq3 (r,h);
cout<<"\n The total surface area of the cylinder is:"<<surfacearea<<endl;
cout<<"\n The lateral surface area of the cylinder is:"<<lateralarea<<endl;
cout<<"\n The volume of the whole cylinder is:"<<volume<<endl;


getch();
}
const double PI = 3.14159;
//Equation to give Total Surface Area
double eq1 (double r, double h)
{double answer= (2 * PI * r)*( r + h);
return answer;

}
//Equation to give Lateral Surface Area
double eq2 (double r, double h)
{double answer= (2 * PI * r * h);
return answer;
}

//Equation to give Volume of the cylinder
double eq3 (double r, double h)
{double answer= (PI * pow(r, 2.0) * h);
return answer;

} 
Thank you so much! Works perfectly, don't know how I missed that right at the top
Topic archived. No new replies allowed.