Lining up decimals & text - code included inside.
Hello, I am having troubles lining up decimals and text in my output.
This is what my output consists of
Code:
No. Last Name Gross LTB EI CPP FED TAX TOT DED NET PAY
111 Lastname01 288.40 4.00 4.04 4.61 67.83 80.48 207.92
222 Lastname02 4807.69 96.00 11.80 11.20 1942.10 2061.10 2746.60
333 Lastname03 405.51 8.00 5.68 6.49 97.53 117.69 287.82
444 Name 11057.69 100.00 11.80 11.20 4606.47 4729.47 6328.22
555 Name 339.68 6.00 4.76 5.43 79.89 96.08 243.60
666 Name 353.32 6.00 4.95 5.65 83.10 99.70 253.62
777 Name 439.20 8.00 6.15 7.03 108.92 130.09 309.11
888 Name 321.20 6.00 4.50 5.14 75.55 91.18 230.02
999 Name 321.92 6.00 4.51 5.15 75.72 91.37 230.55
As you can see its fairly messy.
Here is the code I have written.
Code:
fprintf(outputfile, "No. Last Name Gross LTB EI CPP FED TAX TOT DED NET PAY");
and
Code:
fprintf(outputfile, "\n%d %s %12.2lf %12.2lf %12.2lf %12.2lf %12.2lf %12.2lf %12.2lf", empnum, lname, grosspay, ltb,
employment_ins, can_pen_plan, fed_tax,
ltb + employment_ins + can_pen_plan + fed_tax,
grosspay - (ltb + employment_ins + can_pen_plan + fed_tax));
I would appreciate any help towards fixing up and formatting this text. Thanks in advance.
As well, its my first post on the forums here :)
PS: I hope this is all the required code needed, if more is needed - let me know.