Thread: Plz Help!!

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    4

    Plz Help!!

    im a beginner and ive been stuck wit this new program ive written

    everytime i try to do a calculation it give me 0.00 for answer plz help me! i cant find what i did wrong...ty

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    47
    Code:
    fprintf(wptr," Your incomes = %d ",&income);
    fprintf(wptr,"\n\n Your tax = %d ",&tax);
    Change the %d to %f.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Looking at the quoted code, remove the & symbol. Unless you actually mean to be printing the address of those two variables...

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

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Also, if you're trying to write C, then name your files with a .c extension. Otherwise your compiler is likely to compile it as C++.
    If you understand what you're doing, you're not learning anything.

  5. #5
    Registered User
    Join Date
    Jul 2006
    Posts
    4
    thnx a lot that fixed some of my error. The first time i type in a number for income it work fine but the second income number i put in it will alway give me the answer for the first one..can some1 help me plz?
    Last edited by Desperate; 07-06-2006 at 08:39 AM.

  6. #6
    Registered User
    Join Date
    Jul 2006
    Posts
    10
    Code:
    scanf("%d", &income);
    Should be %f

    Code:
    tax = '0';}
    Surrounding the zero in single quotes turns it into a character and I think you'll be getting the ASCII value rather than 0.

    Code:
    else(income > 13430 && income <= 15610);{
    The semi-colon shouldn't be there and else can't take parenthesis, use else if again instead.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. plz help me...
    By sweetchakri in forum C Programming
    Replies: 1
    Last Post: 03-03-2009, 11:50 PM
  3. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 09:54 AM
  4. Anyone plz help me
    By Rose_Flowers in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM