-
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
-
> 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
-
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.
-
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
-
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!