Does not run!!???

This is a discussion on Does not run!!??? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Hello friends: This simple, piece of cake program gives me an error message at line 8. I am using a ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    7

    Question Does not run!!???

    Hello friends:

    This simple, piece of cake program gives me an error message at line 8. I am using a DOS base compiler called "Miracle C". Please see the codes:

    main()
    {
    float gross,tax,net;
    printf("Gross Salary:");
    scanf("%f", &gross);
    tax=0.14*gross;
    net=gross-tax;
    printf("Taxes withheld: %.2f\n", tax);
    printf("Net salary: %.2f", net);
    }

    Thanks

    SAMSEIED

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,854
    > gives me an error message at line 8
    Again, this works for me
    And be more specific about the error - like paste the actual text of the message

    Your compiler is either broken or badly installed.

    I've never quite trusted floating point on DOS compilers

    free compilers can be downloaded from http://www.compilers.net/ & http://www.thefreecountry.com/developercity/index.html

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    It also works for me, used GCC 3.03.

    BTW, you forgot to return a return-value at the end of main. It is not blocking, but results in returning an undefined value.

  4. #4
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    That's probably the error...using the MingW compiler, it'll give a error on line 8 when it's on line 10 for example

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I'm with Salem on DOS's floating point. At least this isn't Mainframe assembler where you have to keep track of the decimal with pen and paper!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Re-doing a C program to run in Win2000 or XP
    By fifi in forum C Programming
    Replies: 5
    Last Post: 08-17-2007, 06:32 PM
  2. how to run an exe command in c++ and get back the results?
    By mitilkhatoon in forum C++ Programming
    Replies: 5
    Last Post: 09-21-2006, 07:00 PM
  3. calculating the mode
    By bigggame in forum C Programming
    Replies: 10
    Last Post: 06-13-2006, 04:04 AM
  4. How I can Run exe file in C++
    By palang in forum C++ Programming
    Replies: 2
    Last Post: 05-10-2006, 12:55 PM
  5. Replies: 2
    Last Post: 10-29-2002, 04:56 PM

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