#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> /* 1. 구조체 struct point를 정의하시오. double x, y를 멤버로 갖는다. */ /* 2. 함수 calc_dist를 구현하시오. struct point 데이터형의 인수 A와 B를 받아서, A와 B간의 거리를 소숫점 둘 째 자리까지 출력한다. (출력의 끝에는 줄바꿈 문자가 없다.) 힌트: A와 B를 2차원 상의 두 점으로 생각하면, 거리 구하는 공식은 sqrt((x1 - x2)^2 + (y1 - y2)^2) 제곱근 계산하는 함수는 double sqrt(double)을 사용한다. */ //-------------- 이하 수정 금지 void main(void) { struct point p1; struct point p2; double x1, y1; double x2, y2; scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); p1.x = x1; p1.y = y1; p2.x = x2; p2.y = y2; calc_dist(p1, p2); }