Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about fstream and double 1

Status
Not open for further replies.

Kherozen

Programmer
Jun 5, 2003
129
CA
Hi,
I've got a simple question and I can't find the answer anywhere.

my problem is fairly simply
my program is writing numbers into a file and I need those number to show always and only 2 numbers after the point (like 5.00, 4.59, etc.)
I try myFile.precision(2) but it seems thats not it



jul ^_^
"Computer Science is no more about computers than astronomy is about telescopes"
E. W. Dijkstra.
 
#include<iomanip>

using std::setprecision;

.
.
.
myFile << fixed << setprecision(2) << theDouble;

if you follow my drift
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top