Question #516

How to output a floating point number with a specified number of decimal places into the stream?

Expert's answer

The easiest way is to use the manipulators. For example, std::setiosflags(std:: ios_base:: fixed), std::setprecision(2) sets 2 decimal places output.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS