std::showpoint
Defined in header <ios> | | |
---|---|---|
std::ios_base& showpoint( std::ios_base& str ); | (1) | |
std::ios_base& noshowpoint( std::ios_base& str ); | (2) | |
启用或禁用在浮点输出中无条件地包含小数点字符.。对输入没有影响。
1%29启用showpoint
溪流中的旗子str
好像通过打电话str.setf(std::ios_base::showpoint)
2%29禁用showpoint
溪流中的旗子str
好像通过打电话str.unsetf(std::ios_base::showpoint)
这是一个I/O操作程序,可以用表达式调用它,如out << std::showpoint
对任何out
类型std::basic_ostream
或使用表达式,如in >> std::showpoint
对任何in
类型std::basic_istream
...
要用作小数点字符的字符由输出时注入到流中的区域设置的num点面确定,如std::num_put::put
...
参数
str | - | reference to I/O stream |
---|
返回值
str
%28操作后对流的引用%29。
例
二次
#include <iostream>
int main()
{
std::cout << "1.0 with showpoint: " << std::showpoint << 1.0 << '\n'
<< "1.0 with noshowpoint: " << std::noshowpoint << 1.0 << '\n';
}
二次
产出:
二次
1.0 with showpoint: 1.00000
1.0 with noshowpoint: 1
二次
另见
resetiosflags | clears the specified ios_base flags (function) |
---|---|
setiosflags | sets the specified ios_base flags (function) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com