hmj*_*mjd 100
没有办法改变精度,to_string()但setprecision可以使用IO操纵器代替:
#include <sstream>
template <typename T>
std::string to_string_with_precision(const T a_value, const int n = 6)
{
std::ostringstream out;
out.precision(n);
out << std::fixed << a_value;
return out.str();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
53321 次 |
| 最近记录: |