what is wrong it outputs only 0 nothing else
i have 2 kinds b with range 35 and m with range 17 if they can shoot it should output 1 but it doesnt :( also i didnt forgot math.h lib
int main() {
//i got p o k l and kind1 from user
can_hit(p,o,k,l,kind1);
printf("%d", can_hit(p, o, k, l, kind1));
_getch();
}
double distance(int y, int r, int u, int t) {
return sqrt(((u - y) ^ 2) + ((t - r) ^ 2));
}
int can_hit(int x_0, int y_0, int x_1, int y_1, char kind) {
int w = 17;
int e = 35;
int hit = 0;
double n = distance(x_0, y_0, x_1, y_1);
switch (kind) {
case 'm':
if (w >= n) {
hit = 1;
}
break;
case 'b':
if (e >= n) {
hit = 1;
}
break;
}
return hit;
}