用C语言编写一个程序:定义一个点的坐标,然后定义两个点,求这两个点间的距离。

日期:2017-11-29 14:59:45 人气:1

用C语言编写一个程序:定义一个点的坐标,然后定义两个点,求这两个点间的距离。

#include #include struct Point{ double x, y;};/** Calculate the distance of two points. */double distance(const struct Point *a, const struct Point *b){ return sqrt((a->x-b->x)*(a->x-b->x)+(a->y-b->y)*(a->y-b->y));}in
    A+
热门评论