How to conrol the number of decimals in a cmath program

I am working on a project currently, and I have the program working except that it doesn't output four decimal places like I need it too. I have tried using the setpoint, but that doesn't work. How do I get it to work?

Thanks for your help.
http://www.cplusplus.com/reference/iomanip/setprecision/
Perhaps?

std::cout << std::setprecision(4) << 0.12345678901234567 << std::endl;

Works for me.
Last edited on
Thanks. This worked.
Topic archived. No new replies allowed.