Hi guys,
Im just making a little program that tells you how close an astroid will come to earth, if you give x,y co-ordinates.
Well, thats not revelent...
I get these 2 errors when i got to compile it:
In function `int main()':
invalid operands of types `double*' and `double' to binary `operator&'
For more info on the question, go here: http://elm.eeng.dcu.ie/~oconaire/ioi2008/round1/
And if anybody could reply to this quickly, it would be greatly appreciated as I have to have it submitted it by tomorrow
Thanks
Im just making a little program that tells you how close an astroid will come to earth, if you give x,y co-ordinates.
Well, thats not revelent...
I get these 2 errors when i got to compile it:
In function `int main()':
invalid operands of types `double*' and `double' to binary `operator&'
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main()
{
//declarations
double x,y,r,a,b,c,d,distance;
//inputs
printf("please enter the position of the planet (x,y):"); scanf("%lf %lf", &x &y);
printf("Enter planet radius:");scanf("%lf",&r);
printf("Please enter linear trajectory (ax+by+c=0) of asteroid (a,b,c):"); scanf("%lf%lf%lf", &a,&b,&c);
distance=fabs(a*x+b*y+c)/sqrt(a*a+b*b);
d=distance-r;
printf("The asteroid will pass within %lf of the planet.",d);
getch();
return 0;
}
For more info on the question, go here: http://elm.eeng.dcu.ie/~oconaire/ioi2008/round1/
And if anybody could reply to this quickly, it would be greatly appreciated as I have to have it submitted it by tomorrow
Thanks