![在这里插入图片描述](https://img-blog.csdnimg.cn/20181216194108776.?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3poYW5nZ2lybHpoYW5nYm95,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/201812161941547.?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3poYW5nZ2lybHpoYW5nYm95,size_16,color_FFFFFF,t_70)
代码
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double a[4];
while(cin>>a[0]>>a[1]>>a[2]>>a[3]) {
double ans = sqrt((a[2]-a[0])*(a[2]-a[0]) + (a[3]-a[1])*(a[3]-a[1]));
printf("%.2f\n", ans);
}
return 0;
}
注解
1、水题。
2、二维欧氏距离公式。
结果
![在这里插入图片描述](https://img-blog.csdnimg.cn/2018121619443036.)