「cout」の編集履歴(バックアップ)一覧はこちら
cout - (2010/01/27 (水) 15:51:36) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
''[[入出力]]も参照''
=== 0で詰めて表示 ===
#include <iostream>
#include <iomanip>
...
int main(){
unsigned num = 2;
cout << setw(4) << setfill('0') << num << endl; → '0002'
double fig = 0.15;
fig+=1e-8; これがないと,切り上げの関係で '014' になる!!!
cout << setw(3) << setfill('0') << (int)(100.0*fig) << endl; → '015'
return 0;
}
''[[入出力]]も参照''
=== 0で詰めて表示 ===
#include <iostream>
#include <iomanip>
...
int main(){
unsigned num = 2;
cout << setw(4) << setfill('0') << num << endl; → '0002'
double fig = 0.15;
fig+=1e-8; これがないと,切り上げの関係で '014' になる!!!
cout << setw(3) << setfill('0') << (int)(100.0*fig) << endl; → '015'
return 0;
}