题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2001
//C++代码
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
double a,b,c,d;
while(cin>>a>>b>>c>>d){
double dist=sqrt((a-c)*(a-c)+(b-d)*(b-d));
cout<<fixed<<setprecision(2)<<dist<<endl;
}
return 0;
}
本文提供了一个使用C++实现的简单程序来计算二维平面上两点之间的欧几里得距离。通过输入两个点的坐标,程序会输出这两点间的精确距离。

被折叠的 条评论
为什么被折叠?



