Advertisement
Josif_tepe

Untitled

Nov 7th, 2021
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. class Point{
  5. private:
  6.     int x, y;
  7. public:
  8.     Point() {}
  9.     Point(int _x, int _y) {
  10.         x = _x;
  11.         y = _y;
  12.     }
  13.     bool operator < (Point p) {
  14.         if(x < p.x and y < p.y) {
  15.             return true;
  16.         }
  17.         return false;
  18.     }
  19.     bool operator > (Point p) {
  20.         if(x > p.x and y > p.y) {
  21.             return true;
  22.         }
  23.         return false;
  24.     }
  25.     void print() {
  26.         cout << x << " " << y << endl;
  27.     }
  28.    
  29. };
  30. int main()
  31. {
  32.     Point p1(1, 3);
  33.     Point p2(2, 5);
  34.    
  35.     if(p2 > p1) {
  36.         cout << "Bigger" << endl;
  37.     }
  38.     else {
  39.         cout << "NOT" << endl;
  40.     }
  41.    
  42.     return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement