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
You have to set the 'float mode' to fixed.
float num = 15.839; // this will output 15.84 std::cout << std::fixed << "num = " << std::setprecision(2) << num << std::endl;