setprecision not working

After data has been read in from a file, I have to set the balance to have 2 numbers after the decimal. The file was inputted into a stuct.
Here's how the output looks:
cout << fixed << setprecision(2) << account.balance;

In output, the prices still read out like $875.6954234564.
Any help is appreciated!
Last edited on
That code should not print more than 2 digits after the decimal point. Make sure that it really is this code that produce the output.
Is account.balance a floating point variable? Or is it your defined class with overloaded operator <<?
It is a double. I'll just look over it and try a few things. I'll report if it still doesnt work.
Topic archived. No new replies allowed.