Hi there! I need to write a function called intersect so that the program i have determines if 2 circles intersect. The first circle has centre (px,py) with radix pr and the second circle has centre (qx,qy) with radix qr. I have no idea how to go about with this or where to start. Any ideas? Thanks a bunch :)

#include <stdio.h>
#include <math.h>
// Put your function intersect here.


int main(){ 
double px,py,pr,qx,qy,qr;

while(1){
    printf("radix 1: ");
    scanf("%lf",&pr); 
    if(pr < 0.0) break;
    printf("centre 1 {x,y}: "); 
    scanf("%lf%lf",&px,&py);

    printf("radix 2: "); 
    scanf("%lf",&qr);
    printf("centre 2 {x,y}: "); 
    scanf("%lf%lf",&qx,&qy);

    if(intersect(px,py,pr,qx,qy,qr))
       printf("The circles intersect.\n\n");
else 
    printf("The circles do not intersect.\n\n");
} return 0;
)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.