showpos/noshowpos
stream manipulator ios_base& showpos ( ios_base& str ); ios_base& noshowpos ( ios_base& str ); | ios_base |
cplusplus.com |
Set/Unset showpos format flag
showpos sets the format flag to always insert a plus sign (+) before every non-negative value.
noshowpos unsets this flag, not showing any sign before non-negative values.
Parameters.
Return Value.
A reference to the stream object.
Example.
// modify showpos flag
#include <iostream>
using namespace std;
int main () {
int n;
n=75;
cout << showpos << n << endl;
cout << noshowpos << n << endl;
return 0;
}
The execution of this example shall display:
+75
75
See also.
flags,
setf,
unsetf
ios_base class