#include <iomanip> // the rest of the code double a = 4.032; cout << fixed << setprecision(2); cout << a; // done;
int x = 109887; cout << fixed << setprecision(3) << x;