What do I do to set number of decimals in C++?
Printable View
What do I do to set number of decimals in C++?
What do you mean?
like 12.04 or 12.045 etc?
cout.setf(ios::showpoint);
cout.setf(ios::fixed);
cout.precision(2);
The cout.precision line is what you want the rounding to. 2 means to the nearest hundredth, 3 to the nearest thousandth, etc
Maybe you mean setprecision(), where setprecision(0) means that there are no decimal points...