rozzyroz
10-02-2007, 01:01 PM
i am in a class for basic c programming, and am having a problem finding out what i missed here. all was good till i added the last function (usable) and the code to go with it (highlighted red). can anyone see what mistake i have?
thanks!
#include <stdio.h>
#include <math.h>
float LxW (int, int);
float circle (int);
float usable (float, float, float);
/************************************************** *****************************
this is where the user will enter in the total area of the land.
************************************************** *****************************/
main()
{
int length, width, length2, width2, radius;
float area, area2, area3, land;
printf ("Enter in the length of the property--->");
fflush (stdin);
scanf ("%d", &length);
printf ("enter in the width of the property--->");
fflush (stdin);
scanf ("%d", &width);
area = LxW (length, width);
printf ("The total area of the property is--->%4.2f", area);
/************************************************** *****************************
this is where the user will enter in the area of the house.
************************************************** *****************************/
printf ("\n\nEnter in the length of the structure--->");
fflush (stdin);
scanf ("%d", &length2);
printf ("enter in the width of the structure--->");
fflush (stdin);
scanf ("%d", &width2);
area2 = LxW (length2,width2);
printf ("the total area of the structure is--->%4.2f", area2);
/************************************************** *****************************
this bit of code will determine the area of a round pool.
************************************************** *****************************/
printf ("\n\nEnter in the radius of the pool--->");
fflush (stdin);
scanf ("%d", &radius);
area3 = circle(radius);
printf ("the total area of the pool is--->%4.2f", area3);
/************************************************** *****************************
this determines the total usable portion of the land minus the pool and
building.
************************************************** *****************************/
land = usable(area,area2,area3);
printf ("the total usable area of the land is--->%4.2f", land);
return (0);
}
/* ************************************************** ***************************
functions.
************************************************** *****************************/
float LxW (l, w)
{
float area;
area = l * w;
return (area);
}
float circle (radius)
{
float area;
float answer;
answer = pow (radius,2);
area = answer * 3.14159265359;
return (area);
}
float usable (area, area2, area3)
{
float land;
land = (area-area2)-area3;
return (land);
}
thanks!
#include <stdio.h>
#include <math.h>
float LxW (int, int);
float circle (int);
float usable (float, float, float);
/************************************************** *****************************
this is where the user will enter in the total area of the land.
************************************************** *****************************/
main()
{
int length, width, length2, width2, radius;
float area, area2, area3, land;
printf ("Enter in the length of the property--->");
fflush (stdin);
scanf ("%d", &length);
printf ("enter in the width of the property--->");
fflush (stdin);
scanf ("%d", &width);
area = LxW (length, width);
printf ("The total area of the property is--->%4.2f", area);
/************************************************** *****************************
this is where the user will enter in the area of the house.
************************************************** *****************************/
printf ("\n\nEnter in the length of the structure--->");
fflush (stdin);
scanf ("%d", &length2);
printf ("enter in the width of the structure--->");
fflush (stdin);
scanf ("%d", &width2);
area2 = LxW (length2,width2);
printf ("the total area of the structure is--->%4.2f", area2);
/************************************************** *****************************
this bit of code will determine the area of a round pool.
************************************************** *****************************/
printf ("\n\nEnter in the radius of the pool--->");
fflush (stdin);
scanf ("%d", &radius);
area3 = circle(radius);
printf ("the total area of the pool is--->%4.2f", area3);
/************************************************** *****************************
this determines the total usable portion of the land minus the pool and
building.
************************************************** *****************************/
land = usable(area,area2,area3);
printf ("the total usable area of the land is--->%4.2f", land);
return (0);
}
/* ************************************************** ***************************
functions.
************************************************** *****************************/
float LxW (l, w)
{
float area;
area = l * w;
return (area);
}
float circle (radius)
{
float area;
float answer;
answer = pow (radius,2);
area = answer * 3.14159265359;
return (area);
}
float usable (area, area2, area3)
{
float land;
land = (area-area2)-area3;
return (land);
}