Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- #define PI 3.14159265
- class vector1
- {
- public:
- double x1, y1, x2, y2;
- double length;
- vector1()
- {
- length = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
- }
- };
- struct vershina
- {
- double x, y;
- };
- vector1 sozdanie(vershina one, vershina two)
- {
- vector1 a;
- a.x1 = one.x;
- a.y1 = one.y;
- a.x2 = two.x;
- a.y2 = two.y;
- return a;
- }
- double ygol (vector1 one, vector1 two, vector1 three)
- {
- double znach;
- znach = (one.length*one.length + two.length*two.length - three.length*three.length)/2*one.length*two.length;
- return znach;
- }
- int main ()
- {
- int result = 0;
- vershina A, B, C;
- cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
- vector1 *arr = new vector1[3];
- arr[0] = sozdanie(A, B);
- arr[1] = sozdanie(B, C);
- arr[2] = sozdanie(A, C);
- double znach = arr[0].length;
- for (int i = 0; i<3; i++)
- if (znach < arr[i].length)
- {
- znach = arr[i].length;
- result = i;
- }
- double itog;
- if (result == 0)
- itog = ygol(arr[1], arr[2], arr[0]);
- else if (result == 1)
- itog = ygol(arr[0], arr[2], arr[1]);
- else itog = ygol(arr[1], arr[0], arr[2]);
- znach = acos(itog)*180.0/PI;
- cout.precision(6);
- cout << fixed << znach;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement