PDA

View Full Version : Does not run!!???



SAMSEIED
05-25-2002, 08:41 PM
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

Salem
05-26-2002, 12:17 AM
> 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

Shiro
05-26-2002, 03:24 AM
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.

Quantrizi
05-31-2002, 06:52 PM
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

sean
06-03-2002, 03:48 PM
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!