hypot()

来源:互联网 发布:csgo mac 黑屏 编辑:程序博客网 时间:2024/05/17 07:07

计算两点之间的距离

#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;    }





原创粉丝点击