my question is, i recieved a float from getData which is stored in cost Sqf. then i send it to the function calculate, and then i print it in the calsulate function and it comes out wrong (i.e. i would type in 22.23 in getData, then in calculate costSqf would = 2.00 when printed)
how do i send the float to calculate so it would = 22.23, the value that main is holding?
thanks and if anyone could help it would be appreciated.Code:int main (void) { int roomLth; int roomWth; int custDsc; float costSqf; float install; float subTotal; float total; /*Statements*/ getData(&roomLth, &roomWth, &custDsc, &costSqf); printf("%6.2f is costSqf", costSqf); calculate(roomLth, roomWth, custDsc, costSqf, &install, &subTotal, &total); /* printResult(total); */ return 0; } /*=================================== calculate function =====================================*/ void calculate (int roomLth, int roomWth, int custDsc, float costSqf, float *install, float *subTotal, float *total) { /*statements*/ int a = roomLth; int b = roomWth; float c = costSqf; printf("\n%f is roomWth", costSqf); g = calcInstall (a, b, c); printf("\n %6.2f test\n", g); e = calcSubTotal (g, d); printf("%6.2f e \n", e); /* calcTotal (e, &f); *install = g; *subTotal = e; *total = f; */ return; }
thanks



LinkBack URL
About LinkBacks


