Compartilhar via


showpos

Causes positive numbers to be explicitly signed.

ios_base& showpos(
   ios_base& _Str
);

Parameters

  • _Str
    A reference to an object of type ios_base, or to a type that inherits from ios_base.

Return Value

A reference to the object from which _Str is derived.

Remarks

noshowpos is the default.

The manipulator effectively calls _Str.setf(ios_base::showpos), and then returns _Str.

Example

// ios_showpos.cpp
// compile with: /EHsc
#include <iostream>

int main( ) 
{
   using namespace std;
   int i = 1;

   cout << noshowpos << i << endl;   // noshowpos is default
   cout << showpos << i << endl;
}
1
+1

Requirements

Header: <ios>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions

Other Resources

<ios> Members