Please help

This is a discussion on Please help within the C Programming forums, part of the General Programming Boards category; i have tried to get my data to print. I know that it is something simple that is missing. Data ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    5

    Please help

    i have tried to get my data to print. I know that it is something simple that is missing.



    Data File

    Tanya Bauer 40 7.50
    Dana Clark 45 14.90
    Sara Erickson 38 12.00
    Scott Howard 42 9.75
    Paul Irwin 48 8.72
    Dale Miller 40 10.25
    Bret Rossi 35 8.00
    Karen Thomas 48 9.00
    Tracy York 36 11.00
    Attached Files Attached Files
    • File Type: c 7-2.c (2.4 KB, 68 views)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Didn't I JUST answer this??

    printf("%20[^\n] %4.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
    empname,&hours,&payrate,&overtime,&gross,&tax,&net );
    Do NOT USE & in PRINTF.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Ew, globals out the wazoo. You need to include stdlib.h to use the system function.

    >I know that it is something simple that is missing
    Actually, it's something there that shouldn't be.
    printf("%20[^\n] %4.2f %5.2f %5.2f %5.2 %5.2f %5.2f",empname,hours,&payrate,&overtime,&gross,&ta x,&net);

    should be

    printf("%20[^\n] %4.2f %5.2f %5.2f %5.2f %5.2f %5.2f",empname,hours,payrate,overtime,gross,tax,ne t);
    Last edited by Prelude; 03-19-2002 at 07:06 PM.
    My best code is written with the delete key.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Didn't I JUST answer this??
    Maybe your solution was too cryptic, I mean you only gave the exact line and described the change to make.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21