Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <fstream>
- #include <clocale>
- #include <curses.h>
- #include <cstdlib>
- #include <cstdio>
- using namespace std;
- class dpoint
- {
- private:
- double *px;
- double *py;
- public:
- dpoint() // конструктор без параметров
- {
- px = new double(0);
- py = new double(0);
- }
- ~dpoint()
- {
- if (px != NULL)
- delete px;
- if (py != NULL)
- delete py;
- }
- dpoint(dpoint &z) //конструктор копирования
- {
- px = new double(*z.px);
- py = new double(*z.py);
- }
- dpoint(double x0, double y0) //конструктор с параметрами
- {
- px = new double(x0);
- py = new double(y0);
- }
- void input();
- void output();
- friend istream &operator>>(istream &in, dpoint &z);
- dpoint &operator=(dpoint &z) //перегрузка присваивания
- {
- if (this == &z)
- return z;
- *px = *z.px;
- *py = *z.py;
- return *this;
- }
- };
- void dpoint::input()
- {
- cout << "x = ";
- cin >> *px;
- cout << "y = ";
- cin >> *py;
- }
- istream &operator>>(istream &in, dpoint &z)
- {
- cout << "x = ";
- in >> *z.px;
- cout << "y = ";
- in >> *z.py;
- return in;
- }
- void dpoint::output()
- {
- cout << "x = " << *px << endl;
- cout << "y = " << *py << endl;
- }
- class treug : public dpoint
- {
- private:
- dpoint *pa;
- dpoint *pb;
- dpoint c;
- public:
- treug()
- {
- pa = new dpoint(0, 0);
- pb = new dpoint(0, 0);
- }
- treug(double x1, double y1, double x2, double y2, double x3, double y3) : c(x3, y3)
- {
- pa = new dpoint(x1, y1);
- pb = new dpoint(x2, y2);
- }
- ~treug()
- {
- if (pa != NULL) delete pa;
- if (pb != NULL) delete pb;
- }
- treug(treug &z)
- {
- pa = new dpoint(*z.pa);
- pb = new dpoint(*z.pb);
- c = z.c;
- }
- treug& operator=(treug &z)
- {
- if (this == &z) return z;
- *pa = *z.pa;
- *pb = *z.pb;
- c = z.c;
- }
- void output()
- {
- pa->output();
- pb->output();
- c.output();
- }
- friend void nev();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement