C++ format float number output
Hi,
I don't succeed with formating output for float number, all I want is a list like : 0.00 15.00 12.25 13.56 12.50 from float like : 0.0 15.0 12.25 13.56 12.5 nothing hard but I can not figure out how cout work, I tried : Code:
cout.precision(3); 0.00 15.0 12.2 13.6 12.5 Any suggestion or where to find man for that will be much apprechated ;) |
try
cout.setf(ios::fixed, ios::floatfield); cout.precision(2); |
Maaaannny thanks ;)
|
or just:
printf("%.2f", myfloat); |
All times are GMT -5. The time now is 10:39 PM. |