Namespaces
Variants
Views
Actions

std::fixed, std::scientific, std::hexfloat, std::defaultfloat

From cppreference.com
< cpp‎ | io‎ | manip
Revision as of 10:44, 10 January 2012 by Cubbi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:cpp/io/manip/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <ios>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
std::ios_base& fixed( std::ios_base& str );
</td>

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
std::ios_base& scientific( std::ios_base& str );
</td>

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
std::ios_base& hexfloat( std::ios_base& str );
</td>

<td > (3) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
std::ios_base& defaultfloat( std::ios_base& str );
</td>

<td > (4) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Modifies the default formatting for floating-point I/O

1) sets the floatfield of the stream str to fixed as if by calling Template:cpp

2) sets the floatfield of the stream str to scientific as if by calling Template:cpp

3) sets the basefield of the stream str to fixed and scientific simultaneously (this enables hexadecimal floating-point formatting) as if by calling Template:cpp

4) sets the basefield of the stream str to zero, as if by calling Template:cpp

This is an I/O manipulator, it may be called with an expression such as Template:cpp for any out of type Template:cpp or with an expression such as Template:cpp for any in of type Template:cpp.

Contents

Parameters

str - reference to I/O stream

Return value

str (reference to the stream after manipulation)

Example

Template:example cpp

See also

Template:cpp/io/manip/dcl list setprecision