#include <iostream>
using namespace std;
int main ()
{int n = 1234;
cout.width (9); // 位宽设置
cout.fill ('0');// 不满足位宽的数字用 0 补齐
cout<< right << n << endl;
float m = 0.123;
cout.precision (2);
cout << m <<endl;
return 0;
}
结果如下
000001234
0.12
Process returned 0 (0x0) execution time : 0.147 s
Press any key to continue.