随笔-379  评论-37  文章-0  trackbacks-0
小数点后保留2位数:

float x = 100.1234;
char buf[8] = { 0 };
::sprintf(buf, "%0.2lf", x);
posted on 2022-10-20 15:34 小王 阅读(112) 评论(0)  编辑 收藏 引用 所属分类: c++ 程序设计基础