
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double x1,y1,x2,y2,dist;
while(cin >> x1 >> y1 >> x2 >> y2)
{
dist = sqrt(pow(x1-x2,2)+pow(y1-y2,2));
cout << fixed << setprecision(2) << dist << endl;
}
return 0;
}
注意:要求输出两位小数点,这要用到一个iomanip库。
头文件:#include
说明:是I/O流控制头文件,就像C里面的格式化输出一样
其他格式化设置参考博文:
https://www.cnblogs.com/lsgxeva/p/7696410.html
2374

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



