int main (void) { double area (double r), circumference (double r), volume (double r); printf ("radius = 1: %.4f %.4f %.4f\n", area(1.0), circumference(1.0), volume(1.0)); printf ("radius = 4.98: %.4f %.4f %.4f\n", area(4.98), circumference(4.98), volume(4.98)); return 0; }
int main (void) { // Get the size of the pizza from the user printf("What's the diameter of the pizza? "); float pizza_diameter = GetFloat(); float pizza_circumference = circumference(pizza_diameter); float pizza_area = area( pizza_diameter / 2.0 ); printf("The pizza is %f inches around.\n", pizza_circumference); printf("The pizza has %f square inches.\n", pizza_area); }
double cylinderLateralArea(const Cylinder* c) { if (!c || c->radius < 0 || c->height < 0) { return -1; } return circumference(c->radius) * c->height; }