共用方式為


setprecision

Sets the precision for floating-point values.

T5 setprecision( 
   streamsize _Prec 
);

Parameters

  • _Prec
    The precision for floating-point values.

Return Value

The manipulator returns an object that, when extracted from or inserted into the stream str, calls str.precision(_Prec), and then returns str.

Example

See setw for an example of using setprecision.

Requirements

Header: <iomanip>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions