#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//1. 一共有4个字符 在输出真正字符的 前面填充0
cout << setw(4) << setfill('0') << 11;
//0011
/*****************************************/
//2.一共3位 不够后面补0
cout << fixed << setprecision(3) << 0.12346;
//0.123
cout << fixed << setprecision(3) << 0.1;
//0.100
return 0;
}
C++输出
最新推荐文章于 2023-06-24 16:49:57 发布