Home > Back-end >  Known coordinates and radius, and two circles of the intersection area
Known coordinates and radius, and two circles of the intersection area

Time:12-29



#include
#include
# define PI 3.14
Int main () {
Int x1, y1, x2, y2;
Float r, dis.
Float d;
Float lsqare;
Float ysqare;
Float dsqare;
Float du;
Float t;
While (the scanf (" % d % d % d % d % f ", & amp; X1, & amp; Y1, & amp; X2, & amp; Y2, & amp; R)! EOF)={
Dis=SQRT (pow (fabs (x1, x2), 2) + pow (fabs (y1, y2), 2));

If (dis==0) {
Printf (" coincidence \ n ");
}
Else if (dis==r * 2) {
Printf (" tangent \ n ");
}
Else if (dis> 2 * r) {
Printf (" phase from the \ n ");
}
Else if (dis<2 * r) {
Printf (" intersection ");
D=SQRT (r, 2) - (pow pow (dis)/2, 2);
Lsqare=d * dis.
T=dis/2.0;
Du=atan (d/t);
Du *=2.0;
Du=(PI * 2 - du)/PI;
Ysqare=du * PI * pow (r, 2);
Dsqare=PI * pow (r, 2) * 2 - ysqare - lsqare;
Printf (" % 0.2 f \ n ", dsqare);
}
}
return 0;
}

What's the problem with this code, please?

CodePudding user response:

As a common sense, floating point Numbers is not the same,
  • Related