Untitled
unknown
plain_text
2 years ago
345 B
12
Indexable
#include <iostream>
#include <cmath>
using namespace std;
float distance(int x1, int y1, int x2, int y2) {
int a, b;
a = abs(y1 - y2);
b = abs(x1 - x2);
return sqrt(a * a + b * b);
}
int main()
{
int x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
cout << distance(x1, y1, x2, y2);
}
Editor is loading...
Leave a Comment