|
setprecisionmanipulator function
<iomanip> smanip setprecision ( int n ); Set decimal precision Sets the decimal precision to be used by output operations.Behaves as if a call to the stream's member ios_base::precision with n as argument was made. The decimal precision determines the maximum number of digits to be written on insertion operations to express floating-point values. How this is interpreted depends on whether the floatfield format flag is set to a specific notation (either fixed or scientific) or it is unset (using the default notation, which is neither fixed nor scientific):
This manipulator is declared in header <iomanip>, along with the other parameterized manipulators: resetiosflags, setiosflags, setbase, setfill and setw. This header file declares the implementation-specific smanip type, plus any additional operator overload function needed to allow these manipulators to be inserted and extracted to/from streams with their parameters. Parameters
Return ValueUnspecified. This function should only be used as a stream manipulator.Example
The execution of this example displays something similar to:
See also
|