It isn't the decimal point. Maybe I should have elaborated:
my attempt using setfill:
1 2 3 4 5
|
cout << setprecision(2) << fixed;
cout << left << setw(12) << "\n\nQTY" << setw(20) << "Description" << setw(20) << "Unit Price" << setw(20) << "Total Price" << endl;
cout << right << setfill('0') << setw(2) << TV << left << setfill(' ') << setw(20) << "TV" << setfill('0') << setw(7) << TVPrice << setw(8) << TotalPriceTV << endl;
|
Result:
QTY----------Description--------------------Unit Price--------------------Total Price
05TV--------------------500.0002500.000
With dashes as spaces, exactly like that.
Problem 1: QTY needs to be right justified so that the 0 will appear at the beginning. Description needs to be left justified so the items below it will all line up. Now I am left with 05TV, no clue how to add spaces in between?
Problem 2: Since the following items are right justified, the 0 that i need to be leading is coming up as 500.000 and 2500.000 instead of 0500.00 and 02500.00
Problem 3: Need to add a spacing between 500.000 and 2500.000, I've tried using setfill twice here but it's not working
Hope somebody can help me. Thanks