Click to See Complete Forum and Search --> : What means cout.precision (4)?


George2
February 9th, 2003, 03:16 AM
Hi, everyone!

What means cout.precision (4)? Who can give me
a sample to show the usage?


Thanks in advance,
George

SeventhStar
February 9th, 2003, 03:24 AM
it sets the precision of floating point numbers same as the "%.4f" formatter

example

cout.pecision(4);
cout << 445.26382011334;

will output
445.2638

George2
February 9th, 2003, 03:36 AM
Thanks, SeventhStar buddies!

George

Originally posted by SeventhStar
it sets the precision of floating point numbers same as the "%.4f" formatter

example

cout.pecision(4);
cout << 445.26382011334;

will output
445.2638