重载Point

重载Point

其中减法表示向量,乘法表示叉积

struct Point
{
    double x,y;
    friend double operator*(const Point A,const Point B)
    {
        return A.x*B.y-A.y*B.x;
    }
    friend Point operator-(const Point A,const Point B)
    {
        return {A.x-B.x,A.y-B.y};
    }
};
View Code
没有AC不了的题,只有不努力的ACMER!
原文地址:https://www.cnblogs.com/--560/p/4387905.html