PDA

View Full Version : error message



SAMSEIED
05-24-2002, 08:20 PM
Hi:
I am using this C compiler called miracle C.
I did type in all the codes and was hoping it will RUN. But I get
this error message that says "line 15: unrecognised types in comparison
'if (radius < 0) area=0'

here is codes for the program:


#include <stdio.h>
#define PI 3.14159
float process(float radius);
main()
{
float radius, area;
int count, n;
printf("How many circles?");
scanf("%d", &n);

for (count=1; count<=n; ++count) {
printf("\nCircle no.%d: radius=?", count);
scanf("%f", &radius);

if (radius < 0)
area=0;
else
area=process(radius);
printf("Area=%f\n", area);
}
}

float process(float r)
{
float a;
a=PI*r*r;
return(a);
}


Your help is appriciated

Thanks

SAMSEIED

Salem
05-24-2002, 11:50 PM
Seems OK to me - compiles with gcc

You could try
if ( radius < 0.0 )

Oh, and Miracle C is the saddest piece of ........ for a compiler ever!

sean
06-08-2002, 07:20 PM
Yeah. You usually don't want to be mixing types with ints. There's no concrete rule about it (although I think there should be) but the compiler usually just makes assumptions. I would've thought there should be some indentation or something with the lines under the if statement, but if it compiles OK, I guess it's no biggie.,