cout控制输出浮点数小数点后位数

保留小数点后两位:

cout.precision(2);
cout << fixed << val;
posted @ 2017-03-05 21:28  codinRay  阅读(501)  评论(0编辑  收藏  举报