Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. struct Point
  6. {
  7. long double x, y;
  8. };
  9.  
  10. long double dist(Point a, Point b)
  11. {
  12. return sqrt((((b.x - a.x)*(b.x - a.x)) + ((b.y - a.y)*(b.y - a.y))));
  13. }
  14.  
  15. long double calculateA(Point a, Point b)
  16. {
  17. if(b.x - a.x == 0) return 0;
  18. else
  19. {
  20. return (b.y - a.y) / (b.x - a.x);
  21. }
  22. }
  23.  
  24. int main()
  25. {
  26. ios_base::sync_with_stdio(0);
  27.  
  28. Point a,b,c,d;
  29. long double aDist, bDist, cDist, dDist;
  30. long double alfa, beta, gamma, delta;
  31. long double wspA, wspB, wspC, wspD;
  32. cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
  33. aDist = dist(a,b);
  34. bDist = dist(b,c);
  35. cDist = dist(c,d);
  36. dDist = dist(d,a);
  37.  
  38. //cout << aDist << " " << bDist << " " << cDist << " " << dDist << endl;
  39.  
  40. if(aDist + cDist == bDist + dDist) cout << "True" << endl;
  41. else cout << "False" << endl;
  42.  
  43. if(round((dist(a,c) * dist(b,d))) == round((aDist * cDist) + (bDist *dDist ))) cout << "True" << endl;
  44. else cout << "False" << endl;
  45.  
  46. // cout << dist(a,c) << " " << dist(b,d);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement