Advertisement
anhkiet2507

CAU TRUC DIEM

Sep 2nd, 2021
2,575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<iomanip>
  4. using namespace std;
  5. struct Point{
  6.      double x, y;
  7.  
  8. };
  9. void input(struct Point &A){
  10.     cin >> A.x >> A.y;
  11. }
  12. double distance(struct Point &A, struct Point &B){
  13.     double res = sqrt(pow(B.x-A.x,2)+pow(B.y-A.y,2));
  14.     return res;
  15. }
  16. int main(){
  17.     struct Point A, B;
  18.     int t;
  19.     cin>>t;
  20.     while(t--){
  21.         input(A); input(B);
  22.         cout << fixed << setprecision(4) << distance(A,B) << endl;
  23.     }
  24.     return 0;
  25. }
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement