Mos*_*she 10 c++ cout formatter iomanip
使用时cout,<iomanip>标题中定义的默认格式化程序是什么?换句话说,一旦我将格式化程序设置为fixed使用cout << fixed << setPrecision(2),我该如何更改它?或者,我将它改回来的是什么?
cout
<iomanip>
fixed
cout << fixed << setPrecision(2)
rmp*_*251 9
答案是std::defaultfloat在C++ 11中.要在C++ 03中实现这一点,你可以做到
std::defaultfloat
cout.unsetf(std::ios_base::floatfield);
见真的,什么是的"固定的" I/O操纵相反?
sbi*_*sbi 5
相反的std::fixed是std::scientific。
std::fixed
std::scientific
(在这个很好的答案中,您会找到很好的操纵器列表。)
归档时间:
14 年,4 月 前
查看次数:
8286 次
最近记录:
12 年,4 月 前