Форматування виводу

#include <iomanip> - не треба в Code::Block

double a = 1.123;

cout << setprecision(1) << a << endl;

cout << fixed << setprecision(1) << a << endl;

cout << setprecision(2) << a << endl;

cout << fixed << setprecision(2) << a << endl;

cout << setprecision(3) << a << endl;

cout << fixed << setprecision(3) << a << endl;

double b = 1.1;  

cout << "-------------" << endl;

cout << setprecision(3) << b << endl;

cout << fixed << setprecision(3) << b << endl;

1

1.1

1.12

1.12

1.123

1.123

-------------

1.1

1.100