Electrical and Computer Engineering
20
of 52
UAH
CPE 112
Floating-Point
Output Examples
Value
of x
Statement
Output (
means blank)
cout << fixed;
310.0
cout << setw(10)
<< setprecision(2) << x;
310.00
310.00
cout << setw(10)
<< setprecision(5) << x;
310.00000
310.0
cout << setw(7)
<< setprecision(5) << x;
310.00000