Any particular reason my code isn't working? I'm trying to use a function in a function to find the volume of a cylinder. Any help would be appreciated thanks.
Just to make sure something important does not get forgotten, I do have a few points that need to be looked into by the OP:
1.
1 2 3 4 5 6 7 8
float areaofcircle(float circle, int radius)
{
//scope of the function
float area = 0;
area = circle * radius;
return area;
}
if radius receives a float value (i.e. 2.5) then it will lose precision and end as a radius of 2 because it is defined as an integer in the function.
I would change the above function anyway and remove the first parameter float circle
and fix the formula for area.
2.
The same will happen with the height of the cylinder in