I understand that the setprecision() function rounds off floating point numbers but why is the answer shown to different numbers of deciaml places for diferent floating point numbers when the parameter passed to setpresion() is the same.
what do you mean by leading zero? Plus what do you want this to do anyways? If you want it to display 2 points after just change the three to two when working with numbers.
When cout is in scientific notation mode, which it is by default, setprecision affects the number of significant digits.
In fixed point mode, setprecision affects the number of places after the decimal.