Im working on a program for C for engineers. Its not an assignment just trying to practice some and get used to variables, printing, taking user imput, doing calculations, etc. Im making a simple program to calculate what it costs to fill n tanks of radius r and height h with a certain material. Gravel, water, wheat or asphalt... all I could think of. I then have prices for each of these per unit of volume so it will show how much it costs to fill the tanks. But Im having some issues getting it to work.
-----------------------------
#include
int main()
{
double radius;
double height;
double quantity;
double area;
double volume;
int material;
double unit_cost;
double total_cost;
printf("nWhat is the radius of your storage tank?n");
scanf("%1f", &radius);
printf("What is the height of your storage tank?n");
scanf("%1f", &height);
printf("How many tanks would you like to build?n");
scanf("%1f", &quantity);
area = 3.14 * radius * radius;
volume = area * height * quantity;
printf("What would you like to store in these containers?n1) Graveln2) Watern3) Wheatn4) Asphaltn");
scanf("%d", &material);
if (1 == material)
{
unit_cost = 1.56;
}
if (2 == material)
{
unit_cost = .65;
}
if (3 == material)
{
unit_cost = 3.24;
}
if (4 == material)
{
unit_cost = 4.11;
}
total_cost = volume * unit_cost;
printf("nIt will cost you %f dollars to fill up all your tanks with the nmaterial you selected.", total_cost);
return 0;
}
--------------------------
Can anyone give me an tips on what to change or if there is anything really obvious? It seems to not even recognize values you put in for the radius and height... Thanks
BTW, Im using DevC++ as my compiler.