Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. if (Command == "PRINT"){
  2.                File.open("file.txt", std::ios::in);
  3.                 while (!File.eof()) {
  4.                     Train train_to_print;
  5.                     File >> train_to_print;
  6.                     PrintTrain(std::cout, train_to_print);
  7.                     std::cout << std::endl;
  8.                 }
  9.                 File.close();
  10.             }
  11. std::istream& operator>>(std::istream& is, Train& train){
  12.     int Data_ID, Number;
  13.     std::string Name, Type;
  14.     Date Departure_Date, Arrival_Date;
  15.     Time Departure_Time, Arrival_Time;
  16.     double Popularity_Rate;
  17.     is >> Data_ID >> Name >> Number >> Type
  18.        >> Departure_Date >> Departure_Time
  19.        >> Arrival_Date >> Arrival_Time >> Popularity_Rate;
  20.     train = Train(Data_ID,Name,Number,Type,Departure_Date,Departure_Time,Arrival_Date,Arrival_Time,Popularity_Rate);
  21.     return is;
  22. }
  23.  
  24. std::istream& operator>>(std::istream& is, Time& time){
  25.     int mins, hours;
  26.     std::cin >> hours >> mins;
  27.     time = Time(hours,mins);
  28.     return is;
  29. }
  30.  
  31. std::istream& operator>>(std::istream& is, Date& date){
  32.     int day, month, year;
  33.     std::cin >> day >> month >> year;
  34.     date = Date(day,month,year);
  35.     return is;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement