1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> struct point { int x; int y; }; int main(void) { struct point p1, p2; int xdiff, ydiff; double dist; printf("Á¡ÀÇ ÁÂÇ¥¸¦ ÀÔ·ÂÇϽÿÀ(x y): "); scanf("%d %d", &p1.x, &p1.y); printf("Á¡ÀÇ ÁÂÇ¥¸¦ ÀÔ·ÂÇϽÿÀ(x y): "); scanf("%d %d", &p2.x, &p2.y); xdiff = p1.x - p2.x; ydiff = p1.y - p2.y; dist = sqrt(xdiff * xdiff + ydiff * ydiff); printf("µÎ Á¡»çÀÌÀÇ °Å¸®´Â %fÀÔ´Ï´Ù.\n", dist); return 0; } | cs |