3 回答

TA貢獻(xiàn)1807條經(jīng)驗(yàn) 獲得超9個(gè)贊
<iomanip>
cout << setfill('0') << setw(5) << 25;output:00025
setfill
space ' '
setw

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超4個(gè)贊
cout.fill('*');
cout << -12345 << endl; // print default value with no field width
cout << setw(10) << -12345 << endl; // print default with field width
cout << setw(10) << left << -12345 << endl; // print left justified
cout << setw(10) << right << -12345 << endl; // print right justified
cout << setw(10) << internal << -12345 << endl; // print internally justified
這將產(chǎn)生輸出:
-12345
****-12345
-12345****
****-12345
-****12345
- 3 回答
- 0 關(guān)注
- 897 瀏覽
添加回答
舉報(bào)