function
<ios> <iostream>
std::noshowpoint
ios_base& noshowpoint (ios_base& str);
Do not show decimal point
Clears the showpoint format flag for the str stream.
When the showpoint format flag is not set, the decimal point is only written when necessary for floating-point values inserted into the stream: when their decimal part is not zero.
This flag can be set with the showpoint manipulator. When the 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.
For standard streams, the showpoint flag is not set on initialization.
Parameters
- str
- Stream object where to apply.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<) and extraction (>>) operations on streams (see example below).
Parameters
- str
- Stream object whose format flag is affected.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<
) and extraction (>>
) operations on streams (see example below).
Return Value
Argument str.
Example
1 2 3 4 5 6 7 8 9 10 11 12
|
// modify showpoint flag
#include <iostream> // std::cout, std::showpoint, std::noshowpoint
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;
}
| |
Possible output:
30.000 10000. 3.1416
30 10000 3.1416 |
Data races
Modifies str. Concurrent access to the same stream object may cause data races.
Exception safety
Basic guarantee: if an exception is thrown, str is in a valid state.