Floor

double computeTotal(double salesAmt)
{
double Total;
Total = salesAmt + 0.05*salesAmt;
cout << fixed << setprecision(2) << floor(Total) << endl;
return Total;
}

i pass in a value of 139.98 and i need to return to the calling program to 146.90. I need to round down the total but i keep getting 146.00 from the above code, i am unable to change it..
If you multiply by 10, round and divide by 10, you will get the value rounded to the 1st decimal digit
cout << fixed << setprecision(2) << floor(Total*10.0)/10.0 << endl;
tks it works, i spent some time troubleshoot it.. tks alot, u save my day.. =)
Topic archived. No new replies allowed.