Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>ios::precision</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ios::precision

Usage

   #include <iostream.hpp
   int precision(int new_precision);
   int precision() const;

Description

   Set or reads the current floating point precision. This is the number of
   digits that will be displayed after the decimal point in floating point
   representations. The default precision is six digits.

Example 

   double d = 1.0/3;

   cout << "Default precision = " << cout.precision() << endl;
   int oldprec = cout.precision(3);
   cout << d;                      // output is    0.333
   cout.precision(oldprec);
   cout << d;                      // output is    0.333333

Return Value

   The const version returns the current precision. The non-const version
   returns the previous value.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson