/********************************************* ** PROTOTYPES & STRUCT DEFINITIONS *********************************************/ struct point { double x, y; }; void read(point &p, istream &IN); void write(point p, ostream &OUT); point operator+(point a, point b); point operator/(point P, double z); ostream& operator<<(ostream& OUT, point p); istream& operator>>(istream& IN, point &p); /********************************************* ** FUNCTION DEFINITIONS *********************************************/ void read(point &p, istream &IN) { char c; IN >> c >> p.x >> c >> p.y >> c; } void write(point p, ostream &OUT) { OUT << '(' << p.x << ',' << p.y << ')'; } point operator+(point a, point b) { point S; S.x = a.x + b.x; S.y = a.y + b.y; return S; } point operator/(point P, double z) { point Q; Q.x = P.x / z; Q.y = P.y / z; return Q; } ostream& operator<<(ostream& OUT, point p) { write(p,OUT); return OUT; } istream& operator>>(istream& IN, point &p) { read(p,IN); return IN; }