Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<math.h>
- struct point
- {
- int x;
- int y;
- };
- double distance(point a, point b)
- {
- return sqrt((b.y - a.y) * (b.x - a.x) + (b.x - a.x) * (b.x - a.x));
- }
- double max(double a, double b)
- {
- if (a > b) return a;
- else return b;
- }
- int main()
- {
- point a, b;
- double distance;
- std::cin >> a.x >> a.y;
- std::cin >> b.x >> b.y;
- distance = max(distance(a, b), distance(b, a));
- std::cout << distance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement