0

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;
)

Edited by Dani: Formatting fixed

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.