0

Round the float number

Hi everyone. I have some problems. This is my code double n=90.005; cout<< setprecision(2)<<fixed<<n; I want output is 90.01 but the code run and give me the answer is 90.00 But when I try 90.006 output is 90.01. I don't understand why. Can someone show me how to solve this problem????

14th Jan 2019, 11:39 AM
Nguyễn Quang Huy
Nguyễn Quang Huy - avatar
2 Respostas
+ 1
Correct output for your example is 90.00
14th Jan 2019, 6:05 PM
Mina
Mina - avatar