double d = 0.12345; std::cout.precision(2); // for accuracy to 2 decimal places std::cout << d << std::endl; // 0.12