chapter4

求直角三角形斜边函数hypot()以及typedef struct的使用:

struct Point{double x, y;};
double dist(struct a, struct b)
{
    return hypot(a.x-b.x, a.y-b.y);
}

typedef struct{double x, y}Point;
double dist(Point a, Point b)
{
    return hypot(a.x-b.x, a.y-b.y);
}




你可能感兴趣的:(chapter4)