blob: 700962ea2fb9ab65a25288fbcc208dc35ab3dc1e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <iostream>
#include <cmath>
using namespace std;
double distanceBetweenPoints(int x1, int y1, int x2, int y2)
{
int sideA = abs(x1 - x2), sideB = abs(y1 - y2);
return sqrt(sideA * sideA + sideB * sideB); // Pythagorean theorem
}
int main()
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
cout << distanceBetweenPoints(x1, y1, x2, y2) << endl;
}
|