Thread: Does not run!!???

  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
    39,660
    > 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,380
    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
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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, 05: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, 06:00 PM
  3. calculating the mode
    By bigggame in forum C Programming
    Replies: 10
    Last Post: 06-13-2006, 03:04 AM
  4. How I can Run exe file in C++
    By palang in forum C++ Programming
    Replies: 2
    Last Post: 05-10-2006, 11:55 AM
  5. Replies: 2
    Last Post: 10-29-2002, 04:56 PM