#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << "\n0----------------------1------8\n";
cout << setw(22) << left << "Registration Fee ";
cout << setw(8) << right << fixed << setprecision(2) << "$ " << 22.0 << endl;
cout << setw(22) << left << "Hotel Total ";
cout << setw(8) << right << fixed << setprecision(2) << "$ " << 350.00 << endl;
cout << setw(22) << left << "Transportation Total ";
cout << setw(8) << right << fixed << setprecision(2) << "$ " << 5.00 << endl;
cout << setw(22) << left << "Meals Total ";
cout << setw(8) << right << fixed << setprecision(2) << "$ " << 5000.00 << right;
cout << "\n--------------------------------------------\n";
return 0;
}
All I want is two columns, with the stuff in it left aligned, and a second with decimals right aligned. Everytime I think I understand this #$^%$#ing formatting shi...er stuff, I come to realize I'm utterly clueless. Sometimes it will work fine, and I think great! I get it, then like the facacta example above, the output will, instead of giving me numbers lined up at the decimal, it gives me the finger. Can someone please break it down for me. All the examples I can find are of the most basic kind.
From what I understand set() creates a column that will hold something less than it's size, and << right or << left will justifiy it.
Thanks for any help on this incredibly rookie problem
(please note, the example above is just one of many variations I've tried)
Thanks again.