Advertisement
allia

отрезок

Nov 10th, 2020
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. struct otrezok
  8. {
  9.   double x1, y1, x2, y2;
  10.   double len;
  11.   //double *ostanovki;
  12.  
  13.   void length(double x1, double x2, double y1, double y2)
  14.   {
  15.     len = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
  16.   };
  17.  
  18. };
  19.  
  20. int main ()
  21. {
  22.   otrezok bus_1;
  23.  
  24.   cin >> bus_1.x1 >> bus_1.y1;
  25.   cin >> bus_1.x2 >> bus_1.y2;
  26.  
  27.   cout << bus_1.len << " ";
  28.  
  29.   bus_1.length(bus_1.x1, bus_1.x2, bus_1.y1, bus_1.y2);
  30.  
  31.   cout << bus_1.len;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement