void main is undefined; use int main instead.
Printable View
hi
Code:/* Store the program in a file called intresest.c */
#include <stdio.h>
void main()
{
/* Declare and initialize variables */
double principal = 10000.0;
int term = 8.0;
double rate = 8.0;
double simple_interest = 0.0;
scanf("%d", &principal);
scanf("%d", &term);
scanf("%d", &rate);
scanf("%d", &simple_interest);
/* Compute the simpole inerest */
simple_interest = (principal * term * rate) / 100.0;
printf("Total Interest = %6.21f/n", simple_interest);
}
found some errors.I have corrected .above code works fine in VC++ 6
thanks
No, that's not right. 8.0 is a double. 8 is an integer.Code:int term = 8.0;
It should be:
Don't you get warnings?Code:int term = 8;
oops!
yeah I got one warning.
sorry!!!
When writing C, I really suggest you don't ignore them. Many C compilers are not very standards compliant and implicit conversions between types is not legal. Conversion from double to int must be done explicitly or not at all.
You could post any warnings you get next time that you don't understand and we could teach you.
hey thanks Elysia.
Shindel, fully uninstall C-Free 3.5 and try installing C-Free 4, on a different folder if possible. I didn't have to mess with anything to get my projects to compile correctly.
Define compile correctly.
It seems that gcc is the compiler so updating the IDE wont change the way it compiles, but C-Free 3.5 might require a project with files linked in order to compile. You could try creating a project.Quote:
Shindel, fully uninstall C-Free 3.5 and try installing C-Free 4, on a different folder if possible. I didn't have to mess with anything to get my projects to compile correctly.
If you are using Linux I'd do what matsp said and have a go compiling the file from the command line. Unfortunately the command line in windows sucks and you will need to specify where you are running gcc from, which kind of make it too much hassle for me to be bothered with.