Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <math.h>
  4. using namespace std;
  5. struct dot
  6. {
  7. double x;
  8. double y;
  9. };
  10. struct section
  11. {
  12. dot A;
  13. dot B;
  14. double l;
  15. dot mid;
  16. };
  17. double theorem_cos(section a, section b, section c)
  18. {
  19. double x = (c.l * c.l + b.l * b.l - a.l * a.l) / (2 * b.l * c.l);
  20. return acos(x);
  21. }
  22. struct triangle
  23. {
  24. dot A;
  25. dot B;
  26. dot C;
  27. section AB;
  28. section BC;
  29. section AC;
  30. double a;
  31. double b;
  32. double c;
  33. };
  34. int main()
  35. {
  36. freopen("input.txt", "r", stdin);
  37. freopen("output.txt", "w", stdout);
  38. triangle T;
  39. section AB;
  40. section BC;
  41. section AC;
  42. cin >> BC.l >> AC.l >> AB.l;
  43. T.C.x = 0;
  44. T.C.y = 0;
  45. T.B.y = 0;
  46. T.B.x = BC.l;
  47. T.a = theorem_cos(BC, AB, AC);
  48. T.b = theorem_cos(AC, AB, BC);
  49. T.c = theorem_cos(AB, BC, AC);
  50. T.A.x = AC.l * cos(T.c);
  51. T.A.y = AC.l * sin(T.c);
  52. cout << fixed << setprecision(11) << T.C.x << " ";
  53. cout << fixed << setprecision(11) << T.C.y << " ";
  54. cout << endl;
  55. cout << fixed << setprecision(11) << T.B.x << " ";
  56. cout << fixed << setprecision(11) << T.B.y << " ";
  57. cout << endl;
  58. cout << fixed << setprecision(11) << T.A.x << " ";
  59. cout << fixed << setprecision(11) << T.A.y;
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement