cout format floating point

i like to know how to config my cout with manipulators so i can print double
like this

double x=1.0
double y=1.2
double z=1.2222

cout<<x<<endl;
cout<<y<<endl;
cout<<z<<endl;

output:
1.0
1.2
1.222
You can use setprecision, fixed, setw, etc.
Read this http://www.cplusplus.com/reference/iostream/manipulators/ and links inside.
Topic archived. No new replies allowed.