Heres the code:
I'm trying to call the function cost_of_each_container but its not working and i have no idea what i'm doing wrong please help. I know the spacing in the void purpose part is bad but i will fix that later. And if someone could tell me the math for the function cost_of_each_container because i know thats not right (i am trying to find the cost per container). Thanks!
Code:
#include <stdio.h>
void purpose(void);
double cost_of_each_container(double cost);
double total_cost_of_containers(double total);
int main(void)
{
double radius;
double height;
double cps;
int containers;
double cpc;
double total;
purpose();
printf("\tEnter the radius of the base of the container in cm: ");
scanf("%lf", &radius);
printf("\tEnter the height of the container in cm: ");
scanf("%lf", &height);
printf("\tEnter the cost per square centimeter: ");
scanf("%lf", &cps);
printf("\tEnter the number of containers: ");
scanf("%d", &containers);
printf("\n\t ***** OUTPUT *****\n");
printf("\n\tRadius of the container %14.2lfcm\n\n", radius);
printf("\tHeight of the container %14.2lfcm\n\n", height);
printf("\tCost per square centimeter %11.2lf\n\n", cps);
printf("\tNumber of containers %17.2d\n\n", containers);
printf("\t***** CALCULATED VALUES *****\n\n");
cpc = cost_of_each_container(cost);
getch();
return 0;
}
void purpose(void)
{
printf("\n This program computes the cost per container and the total cost \n");
printf(" To use this program the user has to enter the radius, height, and cost per square \n");
printf(" from the keyboard and the program calculates the cost per container and total cost \n");
printf(" then prints out the radius, height, cost per square centimeter, number \n");
printf(" of containers, and the total\n\n\n");
}
double cost_of_each_container(double cost)
{
double cpc;
cpc = containers * cps;
return(cpc);
}
I'm trying to call the function cost_of_each_container but its not working and i have no idea what i'm doing wrong please help. I know the spacing in the void purpose part is bad but i will fix that later. And if someone could tell me the math for the function cost_of_each_container because i know thats not right (i am trying to find the cost per container). Thanks!