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??
// 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;
#include <iostream>
#include <cmath>
#include <cassert>
#include <cctype>
#include <conio.h>
usingnamespace 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();
}
constdouble 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;
}
#include <iostream>
#include <cmath>
#include <cassert>
#include <cctype>
#include <conio.h>
usingnamespace 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();
}
constdouble 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;
}