Javatpoint Logo
Javatpoint Logo

C++ Manipulator noshowbase

C++ manipulator noshowbase function is used to clear the showbase format flag for the str stream.

  • When we use noshowbase, numerical values are inserted into the stream without prefixing them with any numerical base prefix. (i.e. 0 for octal values, 0x for hexadecimal values and no prefix for decimal base values).

Syntax

Parameter

str: stream object whose format flag is affected.

Return value

It returns argument str.

Data Races

Data races may be occurred 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 noshowbase:

Output:

0x14
14

Example 2

Let's see another simple example to demonstrate the use of stream manipulator showbase to force an integer to print in decimal, octal and hexadecimal formats and noshowbase to reset the showbase:

Output:

Printing integers preceded by their base:
100
0144
0x64

Example 3

Let's see another simple example:

Output:

showbase: 0x2a
noshowbase: 2a
With showbase, parsing 3.14 as money gives 0
Without showbase, parsing 3.14 as money gives 0
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