Fippy_Darkpaw
asked on
C++ oftream decimal precision
Having trouble figuring out how to set decimal precision when writing ofstream to .txt file. When I open the text file produced by the following code the result is "0.111111" and not the full number of expected decimal places.
ofstream OF;
OF.open("file_name.txt");
double n = 0.1111111111111111;
OF << n << endl;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, see also http://www.cplusplus.com/reference/iostream/manipulators/setprecision.html
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.