function
<ios> <iostream>

std::noshowpos

ios_base& noshowpos (ios_base& str);
Do not show positive signs
Clears the showpos format flag for the str stream.

When the showpos format flag is not set, no plus signs precede positive values inserted in str.

This flag can be set with the showpos manipulator, which forces the writing of a plus sign (+) before every non-negative numerical value inserted into the stream (including zeros).

For standard streams, the showpos flag is not set on initialization.

Parameters

str
Stream object whose format flag is affected.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<) and extraction (>>) operations on streams (see example below).

Return Value

Argument str.

Example

1
2
3
4
5
6
7
8
9
10
11
// modify showpos flag
#include <iostream>     // std::cout, std::showpos, std::noshowpos

int main () {
  int p = 1;
  int z = 0;
  int n = -1;
  std::cout << std::showpos   << p << '\t' << z << '\t' << n << '\n';
  std::cout << std::noshowpos << p << '\t' << z << '\t' << n << '\n';
  return 0;
}

Possible output:
+1      +0      -1
1       0       -1


Data races

Modifies str. Concurrent access to the same stream object may cause data races.

Exception safety

Basic guarantee: if an exception is thrown, str is in a valid state.

See also