type casting/type conversion not working

Feb 5, 2016 at 9:32am
Hey guys, have to write a beginner's program( I realize there are more efficient ways to perform some things, but have to keep it simple for this assignment). Estimated amount to be paid in taxe
Last edited on Feb 5, 2016 at 10:17am
Feb 5, 2016 at 9:54am
By default it only shows decimals if it affects the value. If all decimals, to a certain level of precision, are all zeroes it will not show any decimals.

If you include <iomanip> and run the following code before outputting you will see two decimal places for all values.

 
cout << fixed << setprecision(2) << endl;

http://www.cplusplus.com/reference/ios/fixed/
http://www.cplusplus.com/reference/iomanip/setprecision/
Last edited on Feb 5, 2016 at 9:57am
Topic archived. No new replies allowed.