calculating the shortest distance between a given point and a circle in a 2D coordinate space-using structures. Distance = |sqrt( (P_X - Center_X)^2 + (P_Y - Center_Y)^2) - Radius|
I am expected to write the structure definitions and the code that generates the distance result.
Please help me complete this program, some parts are editable and some are uneditable:
Examples:
input: 0 0 2
input: 3 4
output: 3.00
/*uneditable*/
#include<stdio.h>
#include<math.h>
/*editable*/
/*uneditable*/
int main(){
point p;
circle c;
float dist;
scanf("%f%f%f",&(c.center.X), &(c.center.Y), &(c.r));
scanf("%f%f",&(p.X), &(p.Y));
/*editable*/
/*uneditable*/
anykey();
return 0;
}
/*editable*/

## Comments

## Leave a comment