Advertisement
Alex_tz307

GEOMETRIE - INCOMPLET

Aug 16th, 2021
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. struct point {
  2.   int x, y;
  3.  
  4.   void read() {
  5.     cin >> x >> y;
  6.   }
  7.  
  8.   point operator - (const point &p) const {
  9.     return point{x - p.x, y - p.y};
  10.   }
  11.  
  12.   void operator -= (const point &p) {
  13.     x -= p.x, y -= p.y;
  14.   }
  15.  
  16.   int operator * (const point &p) const {
  17.     return x * p.y - p.x * y;
  18.   }
  19.  
  20.   int crossP(const point &A, const point &B) const {
  21.     return (A - *this) * (B - *this);
  22.   }
  23.  
  24.   bool operator < (const point &A) const { /// sortez dupa unghi
  25.     return *this * A < 0;
  26.   }
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement