首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::noshowpos

Defined in header <ios>

?

?

std::ios_base& showpos( std::ios_base& str );

(1)

?

std::ios_base& noshowpos( std::ios_base& str );

(2)

?

启用或禁用加号的显示。'+'在非负整数输出中。对输入没有影响。

1%29启用showpos溪流中的旗子str好像通过打电话str.setf(std::ios_base::showpos)...

2%29禁用showpos溪流中的旗子str好像通过打电话str.unsetf(std::ios_base::showpos)...

这是一个I/O操作程序,可以用表达式调用它,如out << std::showpos对任何out类型std::basic_ostream或使用表达式,如in >> std::showpos对任何in类型std::basic_istream...

参数

str

-

reference to I/O stream

返回值

str%28操作后对流的引用%29。

二次

代码语言:javascript
复制
#include <iostream>
int main()
{
        std::cout << "showpos: " << std::showpos << 42 << ' ' << 3.14 << ' ' << 0 << '\n'
                  << "noshowpos: " << std::noshowpos << 42 << ' ' << 3.14 << ' ' << 0 << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
showpos: +42 +3.14 +0
noshowpos: 42 3.14 0

二次

另见

resetiosflags

clears the specified ios_base flags (function)

setiosflags

sets the specified ios_base flags (function)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com