include iostream include math using namespace std double euclidean_dis

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <math.h>
using namespace std;
double euclidean_distance(double x1, double y1, double x2, double y2) {
return pow(pow(x2 - x1, 2) + pow(y2 - y1, 2), 0.5);
}
int main() {
double x1, y1, x2, y2;
cout << "Input x1:";
cin >> x1;
cout << "Input y1:";
cin >> y1;
cout << "Input x2:";
cin >> x2;
cout << "Input y2:";
cin >> y2;
cout << euclidean_distance(x1, y1, x2, y2);
return 0;
}