hdu 2001 计算两点间的距离

计算两点间的距离

 

 思路:录入数据后,利用两点间公式计算答案

代码:

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    double x1, y1, x2, y2;
    while (cin >> x1 >> y1 >> x2 >> y2)
    {
        printf("%0.2lf\n", sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)));
    }

    system("pause");
    return 0;
}

 

posted @ 2020-02-01 21:03  PCDL&TIPO  阅读(128)  评论(0编辑  收藏  举报