I have a list of float values and I want to print them with cout with 2 decimal places.
float
cout
For example:
10.900 should be prin
setprecision(n) applies to the entire number, not the fractional part. You need to use the fixed-point format to make it apply to the fractional part: setiosflags(ios::fixed)
setprecision(n)
setiosflags(ios::fixed)