您的位置:首页 > 编程语言 > C语言/C++

1815[Distance]

2013-11-07 21:18 369 查看
求两个坐标点的距离- -

主要是输出保证有两个小数点~

 

#include<iostream>
#include<cmath>
#include <iomanip>

using namespace std;

int main()
{
int n;
double x1, y1 ,x2, y2;
double y;
cin >> n;
while( n-- )
{
cin >> x1 >> y1 >> x2 >> y2;
y = (x1-x2) * ( x1-x2 ) + (y1-y2) * (y1-y2);
y = sqrt( y );
cout << setiosflags( ios::fixed ) << setprecision( 2 );
cout << y << endl;
}
return 0;
}


 

搞定~

什么时候才能刷题刷成小牛呢[叹气]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c++ sicily