C++ 格式化输出

来源:互联网 发布:卖家如何开通淘宝客 编辑:程序博客网 时间:2024/05/18 19:42
注意:包含头文件:iomanip


整数前面补零
cout<<setfill('0')<<setw(4)<<result<<endl;


输出小数点后固定位数
cout<<fixed<<setprecision(2)<<profit<<endl;

原创粉丝点击