Answer to Question #42616 in C for Ahmad

Question #42616
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*/
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS