1 #include <cstdio>
2 #include <cstring>
3 #include <vector>
4 #include <iostream>
5 #include <algorithm>
6 #include <set>
7 #include <map>
8 #include <queue>
9 #include <cmath>
10
11 using namespace std;
12 struct Point
13 {
14 int x,y;
15 Point(int x = 0,int y = 0): x(x),y(y) {}
16 Point operator = (Point p) {x = p.x;y = p.y;return *this;}
17 };
18
19 Point operator + (const Point& A,const Point& B){return Point(A.x+B.x,A.y+B.y);}
20 Point operator - (const Point& A,const Point& B){return Point(A.x-B.x,A.y-B.y);}
21 Point operator * (const Point& A,int p){return Point(A.x*p,A.y*p);}
22 bool operator == (const Point& A,const Point &B) {return A.x==B.x && A.y == B.y;}
23 bool operator < (const Point& p1,const Point& p2) {return p1.x < p2.x || (p1.x==p2.x && p1.y < p2.y);}
24 istream & operator >> (istream& is,Point& p) {return is >> p.x >> p.y;}
25 ostream & operator << (ostream& os,Point& p) {return os << p.x << " " << p.y;}
26 int main()
27 {
28 Point p1(3,4),p2(7,8);
29 if(p1<p2)
30 cout << "p1 is smaller than p2" << endl;
31 Point p3 = p1 + p2;
32 cout << p3 << endl;
33 Point p4;
34 cin >> p4;
35 cout << p4 << endl;
36 p4 = p3*3;
37 cout << p4 << endl;
38 return 0;
39 }