Answered! The user is supposed to enter two points (x,y) and then its supposed to calculate the distance between the two points…

The user is supposed to enter two points (x,y) and then its supposed to calculate the distance between the two points and display it on the output screen.

I am having problems with my math down at the bottom, the complier doesnt like it. Can someone please tell me whats wrong with it? Also, if you see any other mistakes, please let me know. Thanks!

#include <stdio.h include <math..h> struct point float x: float y; void enter a point (struct point pc) float distance (struct point p1, struct point p2) int main (void) struct point pt1, pt2 enter a point (&pt 1) enter a point &pt2) distance (pt pt2) printf (Distance between the points 3.2fAna, distance (pt1, pt2) return 0; void enter a point (struct point pc) printf (Enter X value for point: An) scanf (tf, pc->x) printf (Enter Y value for point: An) scanf (tf, &pc->y) float distance (struct point pl, struct point p2) float d: sqrt (pow (p2.x-p 1.x) 2) pow ((p2.y-pl y), 2) return.

Expert Answer

 Editable Code:

#include <stdio.h>

#include <math.h>

struct point

{

float x;

float y;

};

int enter_a_point(struct point *pc);

float distance(struct point p1, struct point p2);

int main(void)

{

struct point pt1, pt2;

float dist;

enter_a_point(&pt1);

enter_a_point(&pt2);

dist = distance(pt1, pt2);

printf(“Distance between the points=%.2fn”, dist);

system(“pause”);

return 0;

}

int enter_a_point(struct point *pc)

{

printf(“Enter X value for point:n”);

scanf_s(“%f”, &pc->x);

printf(“Enter Y value for point:n”);

scanf_s(“%f”, &pc->y);

return 0;

}

float distance(struct point p1, struct point p2)

{

float d;

d = sqrt(pow((p2.x – p1.x), 2) + pow((p2.y – p1.y), 2));

return d;

}

Still stressed from student homework?
Get quality assistance from academic writers!