Advertisement
Guest User

Bus System

a guest
Dec 11th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. # include <iostream>
  2. # include <string>
  3. using namespace std;
  4.  
  5. class Bus{
  6. private :
  7. int busnum;
  8. int seatnum;
  9. string Arrivaltime;
  10. string starttime,driverName,dest_f,dest_t;
  11. string SeatNo[32];
  12. public:
  13. Bus(int busno, string A_time,string S_time,string D_Name,string d_f,string d_t)
  14. {
  15. busnum=busno;
  16. Arrivaltime=A_time;
  17. starttime=S_time;
  18. driverName=D_Name;
  19. dest_f=d_f;
  20. dest_t=d_t;
  21.  
  22. }
  23. Bus(int S_num)
  24. {
  25. seatnum=S_num;
  26. }
  27. Bus(string passname )
  28. {
  29. SeatNo[seatnum]=passname;
  30. }
  31.  
  32. Bus(){};
  33.  
  34.  
  35. int getNoBus(){return busnum ;}
  36. int getNoSeat(){return seatnum ;}
  37. string getDrName(){return driverName ;}
  38. string getDes_F(){return dest_f ;}
  39. string getDes_T(){return dest_t ;}
  40. string getArri_T(){return Arrivaltime ;}
  41. string getStart_T(){return starttime ;}
  42.  
  43.  
  44. };
  45.  
  46.  
  47. int main()
  48. {
  49.  
  50. Bus b1=new Bus();
  51. int choice;
  52. int bn; //Bus Number
  53. string dn; //Driver's Name
  54. string at; //Arrival Time
  55. string dt; //Departure Time
  56. string df; //Destenation From
  57. string ddt; //Destenation To
  58. int NB,x=0;
  59. Bus sortbus[10];
  60. for(int i=0;i<2;i++)
  61. {
  62.  
  63. cout<<" 1.Install\n 2.Reservation\n 3.Show\n 4.Buses\n 5.Exit\n Enter your choice:";
  64. cin>>choice;
  65. if(choice==1)
  66. { cout<<"Enter bus number:";
  67. cin>>bn;
  68. if(bn==1)
  69. {
  70.  
  71. cout<<"Enter Driver's name:";
  72. cin>>dn;
  73. cout<<"Enter Arrival time:";
  74. cin>>at;
  75. cout<<"Enter Departure time:";
  76. cin>>dt;
  77. cout<<"From: ";
  78. cin>>df;
  79. cout<<"To: ";
  80. cin>>ddt;
  81. b1=new Bus(bn, dn, at, dt, df, ddt);
  82. sortbus[1]=b1;
  83. i--;
  84. }
  85. else if(bn==2)
  86. {
  87.  
  88. cout<<"Enter Driver's name:";
  89. cin>>dn;
  90. cout<<"Enter Arrival time:";
  91. cin>>at;
  92. cout<<"Enter Departure time:";
  93. cin>>dt;
  94. cout<<"From: ";
  95. cin>>df;
  96. cout<<"To: ";
  97. cin>>ddt;
  98. b1=new Bus(bn, dn, at, dt, df, ddt);
  99. sortbus[2]=b1;
  100.  
  101. i--;
  102. }
  103. ///////////////////////////////////////information_of_BUS/////////////////////////////////
  104. }
  105. else if(choice==3) {
  106.  
  107. cout<<"Enter no.Bus"<<endl;
  108. cin>>NB;
  109. switch (NB)
  110. {
  111. case 1:
  112. {
  113. cout<<"sd"<<endl;
  114. string test=b1.getArri_T();
  115. cout<<test;
  116. break;
  117.  
  118. }
  119.  
  120.  
  121. }
  122. }
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement