求两个坐标点的距离- -
主要是输出保证有两个小数点~
#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;
}
搞定~
什么时候才能刷题刷成小牛呢[叹气]