double a=3; //一定是double不能是int
cout.setf(ios::fixed);
cout.precision(2);
cout<<a<<endl;
输出:3.00
double a=3; //一定是double不能是int
cout.setf(ios::fixed);
cout.precision(2);
cout<<a<<endl;
输出:3.00
转载于:https://www.cnblogs.com/xiaovlxx/p/4451533.html