+ 2

How do I select how many decimal places are displayed on my screen

I am writing a code in c++ to give tax and tip and I am using double but i only want it to display numbers in the tenths place how do I fix the problem I am having

8th Dec 2017, 4:34 PM
Anna
Anna - avatar
1 Odpowiedź
+ 8
Use setprecision() function as follows :) https://code.sololearn.com/cKY9zxKlRma2/#cpp Edit: Another way using printf(): https://code.sololearn.com/cAO0mdqJR7Wp/#cpp
8th Dec 2017, 4:49 PM
Shamima Yasmin
Shamima Yasmin - avatar