Aligntment of Text/number
what would be the easiest way to align something like the following:
TOTALS
Total Payroll: 750.00
Number of Checks: 2
Average Paycheck: 375.00
Total SS withheld: 60.00
Total Withholding: 75.00
setw?
# 4 Re: Aligntment of Text/number
sry it wont line up in the box .Put it in [code] tags.
Yes, setw in combination with left/right is the right way to lign up: cout << fixed; // no scientific output
cout << setw(40) << left << "Total Payroll:" << setw(10) << right << setprecision(2) << 750.0 << "\n";
cout << setw(40) << left << "Number of Checks:" << setw(10) << right << 2 << "\n";
cout << setw(40) << left << "Average Paycheck:" << setw(10) << right << 375.0 << "\n";will output 12345678901234567890123456789012345678901234567890
Total Payroll: 750.00
Number of Checks: 2
Average Paycheck: 375.00