【发布时间】:2015-01-27 23:34:37
【问题描述】:
以下每一项都与独特的ostream 格式有关。如何将其恢复为默认值?
#include <iostream>
int main()
{
std::cout << std::fixed;
std::cout << std::setprecision(5) << f << '\n';
std::cout << "scientific:\n" << std::scientific;
/*Cpp 11 standard only*/
std::cout << " hexfloat: " << std::hexfloat << 0.01 << '\n';
"The number 0.01 in default: " << std::defaultfloat << 0.01; }
}
如:
std::set_default?;
还有我该怎么做
hexfloat and defaultfloat
在 Cpp 98 标准中?
setwidth 和 setprecision 之间的技术区别是什么?
【问题讨论】:
标签: c++ c++11 hex iostream fixed