Javatpoint Logo
Javatpoint Logo

C++ Manipulator showpos

C++ manipulator showpos function is used to set the showpos format flag for the str stream.

When we set showpos format flag, then it enables the display of the '+' sign in non-negative integer (including zero) output. Has no effect on input.

Syntax

Parameter

str: stream object whose format flag is affected.

Return value

It returns argument str.

Data Races

Data races may cause when modified str concurrent accesses to the same stream object.

Exceptions

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

Example 1

Let's see the simple example to demonstrate the use of showpos:

Output:

+1	+0	-1
 1	 0	-1

Example 2

Let's see another simple example:

Output:

+75
75

Example 3

Let's see another simple example:

Output:

Enter Number: 24
+24
24
Next TopicC++ Manipulator





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA