In my program I print out a table, one of the columns has money listed. I want to print out the money values neatly and right justified, like below:
$9.00
$8.00
$19.20
$200.90
I can right justify the numbers like so
while(condition)
{
printf("$%5.2f\n", number);
}
But obviously with this method the $ isn't positioned where I want it, and I get an output more like:
$ 9.00
$ 8.00
$ 19.20
$ 200.90
Can I get the formatting I want simply with printf?