CCCPaste

Untitled

#include 

using namespace std;
class Point {
    int x;
    int y;
    
public:
    Point() {}
    Point(int _x, int _y) {
        x = _x;
        y = _y;
    }
    void set_x(int _x) {
        x = _x;
    }
    void set_y(int _y) {
        y = _y;
    }
    int get_x() {
        return x;
    }
    int get_y() {
        return y;
    }
    
    Point operator + (Point tmp) {
        Point result(x + tmp.x, y + tmp.y);
        return result;
    }
    Point operator - (Point tmp) {
        Point result(x - tmp.x, y - tmp.y);
        return result;
    }
    Point operator * (Point tmp) {
        Point result(x * tmp.x, y * tmp.y);
        return result;
    }
    Point operator / (Point tmp) {
        Point result(x / tmp.x, y / tmp.y);
        return result;
    }
    
    
};
int main()
{
    Point p1(1, 2);
    Point p2(3, 4);
    
    Point p3 = p1 + p2;
    Point p4 = p1 - p2;
    Point p5 = p1 * p2;
    Point p6 = p1 / p2;
    cout << p3.get_x() << " " << p3.get_y() << endl;
    cout << p4.get_x() << " " << p4.get_y() << endl;
    cout << p5.get_x() << " " << p5.get_y() << endl;
    cout << p6.get_x() << " " << p6.get_y() << endl;
    return 0;
}