Advertisement
Josif_tepe

Untitled

Mar 31st, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Point {
  6. private:
  7. int x, y;
  8. public:
  9. Point() {}
  10. Point(int _x, int _y) {
  11. x = _x;
  12. y = _y;
  13. }
  14. Point(const Point &tmp) {
  15. x = tmp.x;
  16. y = tmp.y;
  17. }
  18. ~Point() {}
  19.  
  20. Point& operator ++ (int p) {
  21. x++;
  22. return *this;
  23. }
  24. Point& operator -- (int p) {
  25. y--;
  26. return *this;
  27. }
  28. Point& operator = (const Point &tmp) {
  29. x = tmp.x;
  30. y = tmp.y;
  31. return *this;
  32. }
  33. Point& operator += (Point tmp) {
  34. x += tmp.x;
  35. y += tmp.y;
  36. return *this;
  37. }
  38. Point& operator -= (Point tmp) {
  39. x -= tmp.x;
  40. y -= tmp.y;
  41. return *this;
  42. }
  43. Point& operator *= (Point tmp) {
  44. x *= tmp.x;
  45. y *= tmp.y;
  46. return *this;
  47. }
  48. Point& operator /= (Point tmp) {
  49. x /= tmp.x;
  50. y /= tmp.y;
  51. return *this;
  52. }
  53. bool operator == (Point tmp) {
  54. if(x == tmp.x and y == tmp.y) {
  55. return true;
  56. }
  57. else {
  58. return false;
  59. }
  60. }
  61. bool operator != (Point tmp) {
  62. if(x == tmp.x and y == tmp.y) {
  63. return false;
  64. }
  65. else {
  66. return true;
  67. }
  68. }
  69. int get_x() {
  70. return x;
  71. }
  72. int get_y() {
  73. return y;
  74. }
  75. friend ostream& operator << (ostream &stream, Point tmp);
  76. friend istream& operator >> (istream &stream, Point &tmp);
  77. };
  78. ostream& operator << (ostream &stream, Point tmp) {
  79. stream << tmp.x << " " << tmp.y << endl;
  80. return stream;
  81. }
  82. istream& operator >> (istream &stream, Point &tmp) {
  83. stream >> tmp.x;
  84. stream >> tmp.y;
  85. return stream;
  86. }
  87. int main() {
  88.  
  89. Point p;
  90. cin >> p;
  91. Point p2;
  92. cin >> p2;
  93. if(p != p2) {
  94. cout << "ne" << endl;
  95. }
  96. else{
  97. cout << "isti" << endl;
  98. }
  99. return 0;
  100. }
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement