cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
cout format floating point
cout format floating point
Dec 10, 2011 at 6:47pm UTC
deadshot
(5)
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
Dec 10, 2011 at 8:31pm UTC
tfityo
(174)
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.