r/programminghelp • • Oct 06 '20

C++ How to get trailing zeroes without using setprecision

Im working on a project that requires me to do basic arithmetic functions on x and y. My teacher wants us to display 0.0 when doing something like 3.0 - 3.0. The x and y variables are double. I know double automatically displays 0. Is there a way to have the double display 0.0 without using setprecision?

Thank you

4 Upvotes

1 comment sorted by

0

u/[deleted] Oct 06 '20

[deleted]

1

u/Poki_Foo Oct 09 '20

Thank you, this is what my teacher was expecting