From [The.C++.Programming.Language.Special.Edition] 21.4.3 FloatingPoint Output [io.out.float]:
Floatingpoint output is controlled by a format and a precision:
– The
general format lets the implementation choose a format that presents a
value in the style that best preserves the value in the space
available. The precision specifies the maximum number of digits. It
corresponds to printf()’s %g (§21.8).
– The scientific format presents
a value with one digit before a decimal point and an exponent. The
precision specifies the maximum number of digits after the decimal
point. It corresponds to printf()’s %e .
– The fixed format presents a
value as an integer part followed by a decimal point and a fractional
part. The precision specifies the maximum number of digits after the
decimal point. It corresponds to printf()’s %f .
You need to specify the format and precision for floatingPoint output, such as:
LIVE
From [The.C++.Programming.Language.Special.Edition] 21.4.3 FloatingPoint Output [io.out.float]: