C++ iomanip showpoint Manipulator
Example
Print the number 9.0 with and without showpoint:
double x = 9.0;
cout << x << "\n";
cout << showpoint << x;
Definition and Usage
The showpoint manipulator always shows the decimal point for decimal numbers, even when there are no decimals.
Without showpoint, 9.0 is printed as 9. With showpoint, zeros are added after the decimal point, up to 6 digits in total (or the number of digits that you set with setprecision()).
The showpoint manipulator is defined in the <ios> header file.
Tip: Use noshowpoint to turn it off again.
Syntax
cout << showpoint;
You do not need to include <iomanip> to use showpoint. It is available when you include <iostream>.
Parameter Values
None.
Technical Details
| Returns: | A reference to the stream (you do not use it directly). It changes all the decimal numbers printed after it. |
|---|