Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <utility>
  3. #include <vector>
  4. #include <list>
  5.  
  6. using std::cin, std::cout, std::endl;
  7.  
  8. struct linked_list()
  9. {
  10.   int sled, prev;
  11.   class point;
  12. }
  13.  
  14. vector<linked_list> list;
  15.  
  16. class point {
  17.  public:
  18.  
  19.   //методы
  20.       point(int x, int y) : x{x}, y{y} {};
  21.  
  22.       ~point()
  23.       {
  24.         cout << "I'm dead" << endl;
  25.       }
  26.  
  27.       point(const point &b)
  28.       {      
  29.           x = b.x;
  30.           y = b.y;
  31.       }
  32.  
  33.       //функция
  34.       int x_minus_y() {
  35.         return (x - y);
  36.       }
  37.  
  38.       void set_x(int a) {
  39.         if (x > 0 && x < 100)
  40.         {
  41.           x = a;
  42.         }
  43.         else
  44.         {
  45.           cout << " x < 0 or > 100" << endl;
  46.         }
  47.       }
  48.  
  49.       void set_y(int a) {
  50.         y = a;
  51.       }
  52.  
  53.       int get_x() {
  54.         return x;
  55.       }
  56.  
  57.       int get_y() {
  58.         return y;
  59.       }
  60.  
  61.       pair<int, int> get_xy()
  62.       {
  63.         return make_pair(this.get_x(), this.get_y());
  64.       }
  65.  
  66.  private:
  67.     //поля
  68.       int x, y;
  69.       std::vector <int> v;
  70.  
  71. };
  72.  
  73. int main()
  74. {
  75.   point a = point(1, 10);
  76.   point b = point(2, 6);
  77.   point c;
  78.   c.set_x(b.get_x() - a.get_x());
  79.   c.set_y(b.get_y() - a.get_y());
  80.   cout << c.get_x() << ' ' << c.get_y() << endl;
  81.   cout << c.x_minus_y() << endl;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement