Advertisement
xotohop

station

May 7th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3.  
  4. using namespace std;
  5.  
  6. class station
  7. {
  8.     private:
  9.         string name;    // имя станции
  10.         string number;  // номер поезда
  11.         string arrival; // время прибытия
  12.         string stop;    // время стоянки
  13.     public:
  14.         // конструктор по умолчанию
  15.         station()
  16.         {
  17.             string name;
  18.             string number;
  19.             string arrival;
  20.             string stop;
  21.         }
  22.         // инициализирующий конструктор
  23.         station(string name, string number, string arrival, string stop)
  24.         {
  25.             name = name;
  26.             number = number;
  27.             arrival = arrival;
  28.             stop = stop;
  29.         }
  30.         friend void print(const station & station_);
  31.         // деструктор
  32.         ~station(){};
  33. };
  34.  
  35. void print(const station & station_)
  36. {
  37.     cout << station_.name << endl;
  38. }
  39.  
  40. int main()
  41. {
  42.  
  43.     system("cls");
  44.  
  45.     queue <station> station_main;
  46.    
  47.     string name;
  48.     string number;
  49.     string arrival;
  50.     string stop;
  51.  
  52.     cout << "enter station name: "; cin >> name;
  53.     cout << "enter train number: "; cin >> number;
  54.     cout << "enter train arrival time: "; cin >> arrival;
  55.     cout << "enter train stop time: "; cin >> stop;
  56.     cout << endl;
  57.  
  58.     station station_temp(name, number, arrival, stop);
  59.     print(station_temp);
  60.  
  61.     return 0;
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement