JBTALKS.CC
标题:
C++ setprecision 问题
[打印本页]
作者:
bearbear520
时间:
2012-11-4 02:28 PM
标题:
C++ setprecision 问题
如果我的input 是 34.56但我要output 34.60该怎么打?
作者:
madman91
时间:
2012-11-5 05:40 PM
本帖最后由 madman91 于 2012-11-5 05:45 PM 编辑
#include<iostream.h>
#include<iomanip.h>
void main()
{
float input = 34.56;
cout<<"Float "<<setprecision (3) <<input<<endl;
}
//
setprecision (3)
-> Set decimal,大过5进位,大概是这样
//剩下的自己想想怎样cin input
欢迎光临 JBTALKS.CC (https://www.jbtalks.my/)
Powered by Discuz! X2.5