计算两点之间的距离
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
//计算两点之间的距离
double x1,y1,x2,y2;
cout<<"please input the two point:"<<endl;
cin>>x1>>y1>>x2>>y2;
cout<<hypot((x2-x1),(y2-y1))<<endl;
}
计算两点之间的距离
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
//计算两点之间的距离
double x1,y1,x2,y2;
cout<<"please input the two point:"<<endl;
cin>>x1>>y1>>x2>>y2;
cout<<hypot((x2-x1),(y2-y1))<<endl;
}