set double to 2 decimal places c++ code example
Example: round double to 2 decimal places c++
double d = 0.12345;
std::cout.precision(2); // for accuracy to 2 decimal places
std::cout << d << std::endl; // 0.12
double d = 0.12345;
std::cout.precision(2); // for accuracy to 2 decimal places
std::cout << d << std::endl; // 0.12