Advertisement
allia

остановки доделать

Nov 10th, 2020
938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. class otrezok
  8. {
  9.   public:
  10.   int x1, x2;
  11.   int len;
  12.   int *ostanovki;
  13.  
  14.   void length(int x1, int x2)
  15.   {
  16.     len = x2 - x1+1;
  17.     vse_ostanovki(len, x1, x2);
  18.   }
  19.  
  20.   void vse_ostanovki(int len, int x1, int x2)
  21.   {
  22.     ostanovki = new int[len];
  23.     if (x1 < x2)
  24.      for (int i = 0; i<len; i++)
  25.       ostanovki[i] = x1+i;
  26.     else
  27.       for (int i = 0; i<len; i++)
  28.       ostanovki[i] = x2+i;
  29.   }
  30.  
  31.   void vivod ()
  32.   {
  33.     for (int i = 0; i<len; i++)
  34.       cout << ostanovki[i] << " ";
  35.   }
  36. };
  37.  
  38. int sravn (otrezok one, otrezok two)
  39. {
  40.   int znach = 0;
  41.  
  42.   return znach;
  43. }
  44. int main ()
  45. {
  46.   otrezok bus_1, bus_2;
  47.  
  48.   cin >> bus_1.x1 >> bus_1.x2;
  49.   //cin >> bus_2.x1 >> bus_2.x2;
  50.   bus_1.length(bus_1.x1, bus_1.x2);
  51.  
  52.   bus_1.vivod();
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement