C++ ios Library - Noshowpoint Function


It is used to sets the showpoint format flag for the str stream. When the showpoint format flag is set, the decimal point is always written for floating point values inserted into the stream (even for those whose decimal part is zero). Following the decimal point, as many digits as necessary are written to match the precision set for the stream (if any).


Following is the declaration for std::showpoint function.

ios_base& showpoint (ios_base& str);


str − Stream object whose format flag is affected.

Return Value

It returns Argument str.


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

Data races

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


In below example explains about std::showpoint function.

#include <iostream>

int main () {
   double a = 30;
   double b = 10000.0;
   double pi = 3.1416;
   std::cout.precision (5);
   std::cout <<   std::showpoint << a << '\t' << b << '\t' << pi << '\n';
   std::cout << std::noshowpoint << a << '\t' << b << '\t' << pi << '\n';
   return 0;

Let us compile and run the above program, this will produce the following result −

30.000  10000.  3.1416
30      10000   3.1416