这是我写的
#include <stdio.h>
#include <math.h>
double pd(double n,double m,double x1,double x2,double y1,double y2)
{
double d;
d=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
if(fabs(n-m)<d&&d<fabs(n+m))
return 1;
return 0;
}
main()
{
double r1,r2,r3,x1,y1,x2,y2,x3,y3;
printf("请分别输入三个圆的圆心坐标和半径(x1,y1) (x2,y2) (x3,y3) r1 r2 r3\n");
scanf("%lf%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&r1,&r2,&r3);
if(pd(r1,r2,x1,x2,y1,y2))
printf("园1与园2相交\n");
else
{
if(pd(r2,r3,x2,x3,y2,y3))
printf("园2与园3相交\n");
else
{
if(pd(r1,r3,x1,x3,y1,y3))
printf("园1与园3相交\n");
else
printf("任意两圆都不想交\n");
}
}
}