Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<iomanip>
- using namespace std;
- struct Point{
- double x, y;
- };
- void input(struct Point &A){
- cin >> A.x >> A.y;
- }
- double distance(struct Point &A, struct Point &B){
- double res = sqrt(pow(B.x-A.x,2)+pow(B.y-A.y,2));
- return res;
- }
- int main(){
- struct Point A, B;
- int t;
- cin>>t;
- while(t--){
- input(A); input(B);
- cout << fixed << setprecision(4) << distance(A,B) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement