數(shù)據(jù)格式 20 4 100.000 70.000 -320.000
30 1 0.000 70.000 -300.000
40 4 180.000 80.000 -200.000
50 4 80.000 80.000 -200.000
60 4 90.000 90.000 -100.000
70 4 100.000 100.000 0.000
固定寬度右對(duì)齊ofs << std::setw(10);
精度ofs << std::setprecision(3)<<std::setiosflags(std::ios::fixed);
另外,有時(shí)候用ofstream/ostream輸出整數(shù)的時(shí)候會(huì)帶有可惡的逗號(hào),可以這樣設(shè)置:
locale::global( locale( "", locale::all ^ locale::numeric ) );