Advertisement
Sinux1

T6E5.cpp

Mar 29th, 2016
107
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. using namespace std;
  4.  
  5.  
  6. float distance(float x1, float y1, float x2, float y2)
  7. {
  8.     return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
  9. }
  10.  
  11.  
  12. int main()
  13. {
  14.     float a, b, x, y;
  15.  
  16.     cout << "Enter the first point" << endl;
  17.     cin >> a >> b;
  18.  
  19.     cout << "Enter the second point" << endl;
  20.     cin >> x >> y;
  21.  
  22.     float result = distance(a,b,x,y);
  23.  
  24.  
  25.     cout << "The distance between those two points is " << result << endl;
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement