Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Point {
- private:
- int x, y;
- public:
- Point() {}
- Point(int _x, int _y) {
- x = _x;
- y = _y;
- }
- Point operator + (Point tmp) {
- return Point(x + tmp.x, y + tmp.y);
- }
- Point operator - (Point tmp) {
- return Point(x - tmp.x, y - tmp.y);
- }
- Point operator * (Point tmp) {
- return Point(x * tmp.x, y * tmp.y);
- }
- Point operator / (Point tmp) {
- return Point(x / tmp.x, y / tmp.y);
- }
- bool operator < (Point tmp) {
- if(x < tmp.x and y < tmp.y) {
- return true;
- }
- else {
- return false;
- }
- }
- bool operator <= (Point tmp) {
- if(x <= tmp.x and y <= tmp.y) {
- return true;
- }
- else {
- return false;
- }
- }
- bool operator > (Point tmp) {
- if(x > tmp.x and y > tmp.y) {
- return true;
- }
- else {
- return false;
- }
- }
- bool operator >= (Point tmp) {
- if(x >= tmp.x and y >= tmp.y) {
- return true;
- }
- else {
- return false;
- }
- }
- bool operator == (Point tmp) {
- if(x == tmp.x and y == tmp.y) {
- return true;
- }
- else {
- return false;
- }
- }
- bool operator != (Point tmp) {
- if(x != tmp.x or y != tmp.y) {
- return true;
- }
- else {
- return false;
- }
- }
- void pechati() {
- cout << x << " " << y << endl;
- }
- };
- int main()
- {
- Point a(3, 4);
- Point b(5, 6);
- if(a < b) {
- cout << "POMALO" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement