| setprecision [manipulator] smanip setprecision ( int n ); | <iomanip> | 
| cplusplus.com | 
 Set precision
 
Sets the precision to be used by output operations
as by a call to stream's member
precision(n)
 
The precision determines the maximum number of digits
that shall be output on insertion operations to express floating-point values,
counting both the digits before and after the decimal point.
 
You must include <iomanip> to use this manipulator.
Parameters.
 Return Value.
 
Unspecified.
 
This function should only be used as a stream manipulator.
 Example.
// setprecision example
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
  double f =3.14159;
  cout << setprecision (5) << f << endl;
  cout << setprecision (9) << f << endl;
  return 0;
}
The execution of this example shall display:
   3.1416
  3.14159
 See also.
 
iomanip manipulators