保留小数,但会四舍五入

#include<bits/stdc++.h>
using namespace std;
main()
{double a=2.9939;
    
    cout<<fixed<<setprecision(2)<<a;printf("%.3f", a);
return 0;
}

猜你喜欢

转载自www.cnblogs.com/tyhj/p/9053602.html
今日推荐