- 博客(1)
- 收藏
- 关注
原创 C++ float转std::string 小数位数控制
C++ float转std::string 小数位数控制std::stringstream 方式sprintf 方式std::stringstream 方式 float a = 1122.334455; std::stringstream buf; buf.precision(2);//覆盖默认精度 buf.setf(std::ios::fixed);//保留小数位 buf << a << "文字"; std::string str; str = buf.str();
2020-07-01 15:23:09
6242
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人