Include iomanip library and cout << fixed << setprecision(2) << x;
cout << fixed << setprecision(2) << x;