Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <utility>
- #include <vector>
- #include <list>
- using std::cin, std::cout, std::endl;
- struct linked_list()
- {
- int sled, prev;
- class point;
- }
- vector<linked_list> list;
- class point {
- public:
- //методы
- point(int x, int y) : x{x}, y{y} {};
- ~point()
- {
- cout << "I'm dead" << endl;
- }
- point(const point &b)
- {
- x = b.x;
- y = b.y;
- }
- //функция
- int x_minus_y() {
- return (x - y);
- }
- void set_x(int a) {
- if (x > 0 && x < 100)
- {
- x = a;
- }
- else
- {
- cout << " x < 0 or > 100" << endl;
- }
- }
- void set_y(int a) {
- y = a;
- }
- int get_x() {
- return x;
- }
- int get_y() {
- return y;
- }
- pair<int, int> get_xy()
- {
- return make_pair(this.get_x(), this.get_y());
- }
- private:
- //поля
- int x, y;
- std::vector <int> v;
- };
- int main()
- {
- point a = point(1, 10);
- point b = point(2, 6);
- point c;
- c.set_x(b.get_x() - a.get_x());
- c.set_y(b.get_y() - a.get_y());
- cout << c.get_x() << ' ' << c.get_y() << endl;
- cout << c.x_minus_y() << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement