|
scientificmanipulator function
<ios>
ios_base& scientific ( ios_base& str ); Use scientific notation Sets the floatfield format flag for the str stream to scientific.When floatfield is set to scientific, float values are written using scientific notation, which means the value is represented always with only one digit before the decimal point, followed by the decimal point and as many decimal digits as the precision field specifies. Finally, this notation always includes an exponential part consisting on the letter e followed by an optional sign and three digits. The floatfield format flag is both a selective and a toggle flag, so it can take any of its two possible following values (using the manipulators fixed and scientific), or none of them (using ios_base::unsetf):
The floatfield flag is not set in standard streams on initialization. The precision field can be modified using the ios_base::precision member of the stream. Notice that the treatment of the precision field differs between the default floating-point notation and the fixed and scientific notations. On the default floating-point notation, the precision field specifies the maximum number of meaningful digits to display both before and after the decimal point, while in both the fixed and scientific notations, the precision field specifies exactly how many digits to display after the decimal point, even if they are trailing decimal zeros. Parameters
Return ValueA reference to the stream object.Example
The execution of this example displays something similar to:
See also
|