csansoon

P9.01 P46254 Distance between two points

Dec 1st, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. struct Point {
  5.     double x, y;
  6. };
  7. double dist(const Point& a, const Point& b) {
  8.     return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
  9. }
  10.  
  11. // (c) Carlos Sansón (Best pro1 delegate ever for sure) @csansoon
Advertisement
Add Comment
Please, Sign In to add comment