#include using namespace std; int main() { ios::sync_with_stdio(false); //读入输出优化的强迫症 // 输出宽度10个字符,左对齐,不足补空格,输出3 cout << setw(10) << setfill(' ') << left << 3; cout << "i am huanghai!" << endl; // 输出宽度5,右对齐,不足补0,输出10 cout << setw(5) << setfill('0') << right << 10 << endl; return 0; }