두 점 사이의 거리
언어/c언어2017. 8. 25. 10:15
# include <stdio.h>
# include <math.h>
typedef struct xyCoordinate
{
double x;
double y;
}xyCoordinate;
int main(void)
{
xyCoordinate coordinate[2] = { 0, };
//
coordinate[0].x = 12.0;
coordinate[0].y = 14.0;
coordinate[1].x = 4.0;
coordinate[1].y = 5.0;
printf("%lf \n",
sqrt(pow(coordinate[1].x - coordinate[0].x, 2) +
pow(coordinate[1].y - coordinate[0].y, 2)));
return 0;
}
'언어 > c언어' 카테고리의 다른 글
c언어 3의 배수의 합만 출력 (0) | 2017.08.26 |
---|---|
소수 판별 코드 (0) | 2017.08.26 |
c언어 affine (0) | 2017.08.23 |
회전 (0) | 2017.08.10 |
메모리 누수 확인 (0) | 2017.08.08 |