Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- struct otrezok
- {
- public:
- double x1, y1, x2, y2, x, y;
- double length;
- };
- struct vershina
- {
- double x, y;
- };
- otrezok vector (vershina head, vershina seredina)
- {
- otrezok time;
- time.x1 = head.x;
- time.y1 = head.y;
- time.x2 = seredina.x;
- time.y2 = seredina.y;
- time.x = time.x2 - time.x1;
- time.y = time.y2 - time.y1;
- double znach = time.x;
- time. x = time.y;
- if (znach != 0)
- time.y = -znach;
- else time.y = znach;
- //cout << time.x << " " << time.y << endl;
- time.x1 = time.x2 - time.x;
- time.y1 = time.y2 - time.y;
- return time;
- }
- int main ()
- {
- vershina A, C;
- cin >> A.x >> A.y >> C.x >> C.y;
- otrezok AC, DB;
- vershina seredina_AC;
- seredina_AC.x = (A.x + C.x)/2;
- seredina_AC.y = (A.y + C.y)/2;
- AC = vector (A, seredina_AC);
- DB = vector (C, seredina_AC);
- cout << AC.x1 << " " << AC.y1 << endl;
- cout << DB.x1 << " " << DB.y1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement