jim said:
[color=blue]
> #include<stdio.h>
> #include<math.h>
> void main()[/color]
main returns int, not void. So make that:
int main(void)
[color=blue]
> {
> float x,y,z;
> scanf("%f,%f\n",&x,&y) ;[/color]
scanf returns a value, which you need to check, in case something went
wrong.
[color=blue]
>
> z=(fabs(x)-2)*(fabs(x)-2)+(fabs(y)-2)*(fabs(y)-2)-1;[/color]
What is this supposed to do? Let's assume that x has the value 3.0, and y
has the value 4.0.
fabs(3.0) is 3.0.
fabs(3.0) - 2 is 1.0.
(fabs(3.0) - 2) * (fabs(3.0) - 2) is 1.0.
fabs(4.0) is 4.0.
fabs(4.0) - 2 is 2.0.
(fabs(4.0) - 2) * (fabs(4.0) - 2) is 4.0.
(fabs(3.0) - 2) * (fabs(3.0) - 2) + (fabs(4.0) - 2) * (fabs(4.0) - 2) is
5.0.
(fabs(3.0) - 2) * (fabs(3.0) - 2) + (fabs(4.0) - 2) * (fabs(4.0) - 2) - 1 is
4.0.
So z takes the value 4.0.
Is that what you were expecting?
[color=blue]
>
> if(z<=1e-6)
> {
> printf("the height of the dot is 10 m .\n");
> }
> else
>
>
> printf("the height of the dot is 0 m .\n");
>
>[/color]
main returns int, so add:
return 0;
[color=blue]
>
> }
> i wote it,but it can not run rightly![/color]
What do you mean by "run rightly"? What is it supposed to do?
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)