Decimal Place Formatting

Using this code within a loop:
1
2
3

cout << "$" << setprecision(2) << fixed << total;



Getting an output of:

1
2
 $1559.50
 $155595.00


I want those decimal places to line up and i have tried just about everything but i can't seem to get it to work with the $ on the front of the total.

It works when i set the width and fix it to the right but once i add the dollar sign it seems to throw everything off like i showed above.

Appreicate any advice on this.

Thanks!
Topic archived. No new replies allowed.