Possible Duplicate:
How do I print a double value with full precision using cout?
float a = 175.;
cout << a;
If I run the previous code I'll get just 175, how can I cout the number with (for example) 3 decimal places even they were zeros .. How can I print "175.000" ?!
You need
std::fixed
andstd::setprecision
:These require following header:
Try
setprecision
: