I use manipulators from <iomanip> to control how numbers appear. Without formatting, cout << 3.14159 prints all digits. With formatting, I can show exactly 2 decimal places. Manipulators change the state of cout, affecting all subsequent output until changed.
If I write cout << fixed << setprecision(2);, every double after that prints with 2 decimal places. Common manipulators: fixed (standard notation), scientific (exponential), setprecision(n) (decimal places), and setw(n) (field width).
Each solves a specific formatting problem.