I need to be two decimals precise therefore I am using this code
How come this isn't working ?Code:outData << setw(10) << set iosflags(ios::fixed) << setprecision(2) << totalGP;
This is a discussion on Set Precision Help ! within the C++ Programming forums, part of the General Programming Boards category; I need to be two decimals precise therefore I am using this code Code: outData << setw(10) << set iosflags(ios::fixed) ...
I need to be two decimals precise therefore I am using this code
How come this isn't working ?Code:outData << setw(10) << set iosflags(ios::fixed) << setprecision(2) << totalGP;
What do you mean by not working, what are you getting exactly?
Post the hole code, it's not cauesd by this statement.
Maybe totalGP is not float or double!
Try "setiosflags(ios::fixed);" rather than separating 'set' and 'iosflags' with a space.
May be just a 'typo' in your post, but let's not overlook the obvious.
-Skipper
"When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow
Code:cout << fixed << setw(10) << setprecision(2) << totalGP;
Mr. C: Author and Instructor