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
With , you can use std::fixed and std::setprecision
Here is an example
#include #include int main() { double d = 122.345; std::cout << std::fixed; std::cout << std::setprecision(2); std::cout << d; }
And you will get output
122.34