C++ Manipulator showposC++ 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. SyntaxParameterstr: stream object whose format flag is affected. Return valueIt returns argument str. Data RacesData races may cause when modified str concurrent accesses to the same stream object. Exceptionsstr is in a valid state, if an exception is thrown. Example 1Let's see the simple example to demonstrate the use of showpos: Output: +1 +0 -1 1 0 -1 Example 2Let's see another simple example: Output: +75 75 Example 3Let's see another simple example: Output: Enter Number: 24 +24 24
Next TopicC++ Manipulator
|