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
", sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)));
    }

    system("pause");
    return 0;
}
原文地址:https://www.cnblogs.com/pcdl/p/12250147.html