标签导航:
直接方法有四种:使用 std::fixed 和 std::setprecision 函数。使用 std::to_string。使用 std::round。使用 printf。

c++如何保留小数点后一位

如何保留 C++ 小数点后一位

直接方法: 使用 std::fixed 和 std::setprecision 函数。