Advertisement
totobac

Untitled

Feb 26th, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include<iostream>
  2. #include<math.h>
  3. struct point
  4. {
  5.     int x;
  6.     int y;
  7. };
  8.  
  9. double distance(point a, point b)
  10. {
  11.     return sqrt((b.y - a.y) * (b.x - a.x) + (b.x - a.x) * (b.x - a.x));
  12. }
  13.  
  14. double max(double a, double b)
  15. {
  16.     if (a > b) return a;
  17.     else return b;
  18. }
  19. int main()
  20. {
  21.     point a, b;
  22.     double distance;
  23.  
  24.     std::cin >> a.x >> a.y;
  25.     std::cin >> b.x >> b.y;
  26.     distance = max(distance(a, b), distance(b, a));
  27.  
  28.     std::cout << distance;
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement