#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
//左侧补零
//只针对整数可行,因为没有浮点数左侧补零这种写法 如05.1
int a = 5;
cout << setw(3) << setfill('0') << a << endl;//005
cout << a << endl;//5
int b = 12;
cout.width(4);
cout.fill('0');
cout << b << endl;//0012
cout << b << endl;//12
int c = 12, d = 34;
cout << setw(3) << setfill('0') << c << " " << setw(3) << setfill('0') << d << endl;//012 034
//右侧补零
//只针对小数可行,整数不行,因为整数无法在后面补零
float aa=0.25;
cout << setiosflags(ios::fixed) << setprecision(3) << aa << endl;//0.250
return 0;
}