对于每组输入数据,输出一行,结果保留两位小数。
/* Copyright (c) 2014, 烟台大学计算机学院
* All rights reserved.
* 文件名称:test.cpp
* 作者:陈丹妮
* 完成日期:2015年 5 月 20 日
* 版 本 号:v1.0
*/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int a,b,c,d;
double s;
while(cin>>a>>b>>c>>d)
{
s=sqrt((a-c)*(a-c)+(b-d)*(b-d));
cout<<setiosflags(ios::fixed)<<setprecision(2)<<s<<endl;
}
return 0;
}
心得体会:通过做题能增加自信,也能提高自己的技能,加油!!
原文:http://blog.csdn.net/nufangdongde/article/details/45875767