#include<iostream> #include<cstring> #include<iomanip> using namespace std; int main() { double ce=1.2323; cout<<setprecision(4)<<ce<<endl;//1.232 cout<<setiosflags(ios::fixed)<<setprecision(4)<<ce<<endl;//1.2323 cout<<setiosflags(ios::fixed)<<setprecision(4)<<ce<<endl;//1.2323 cout.unsetf(ios::fixed); cout<<setprecision(4)<<ce<<endl;//1.232 return 0; }
标签:std,main,有效位数,保留,include,小数 From: https://www.cnblogs.com/ruoye123456/p/17069857.html