Prevent scientific notation in ostream when using << with double
问题 I need to prevent my double to print in scientific notation in my file, when I do this outfile << X; 回答1: To set formatting of floating variables you can use a combination of setprecision(n), showpoint and fixed. In order to use parameterized stream manipulators like setprecision(n) you will have to include the iomanip library: #include <iomanip> setprecision(n) : will constrain the floating-output to n places, and once you set it, it is set until you explicitly unset it for the remainder of