#include <iomanip> 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 << "-------------"; 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 |