# KCS151/KCS251 PPS Lab Exercise

## 29. Define a structure data type TRAIN_INFO. The type contains Train No.: integer type, Train name: string, Departure Time: aggregate type TIME, Arrival Time: aggregate type TIME, Start station: string, End station: string. The structure type TIME contains two integer members: hour and minute. Maintain a train timetable and implement the following operations:

### (i) List all the trains (stored according to train number) that depart from a particular station.(ii) List all the trains that depart from a particular station at a particular time.(iii) List all the trains that depart from a particular station within the next one hour of a given time.(iv) List all the trains between a pair of start station and end station.

#### Sample Input and Output

Stdin Inputs:

1 14511 Nauchandi Express
Prayagraj
Saharanpur
10 15 23 10 1 14163 Sangam Express
Prayagraj
Meerut
10 31 21 17 1 12687 Dehradun Express
New Delhi
9 10 16 45 3 1 Prayagraj
2 Prayagraj
10 15 3 Prayagraj
10 10 4 New Delhi
6

Sample Result:

2. Delete Train.

Input Train Number: 14511
Input Train Name: Nauchandi Express
Input Start Station: Prayagraj
Input End Station: Saharanpur
Input Departure Time:
Hour: 10
Minute: 15
Input Arrival Time:
Hour: 23
Minute: 10

2. Delete Train.

Input Train Number: 14163
Input Train Name: Sangam Express
Input Start Station: Prayagraj
Input End Station: Meerut
Input Departure Time:
Hour: 10
Minute: 31
Input Arrival Time:
Hour: 21
Minute: 17

2. Delete Train.

Input Train Number: 12687
Input Start Station: New Delhi
Input Departure Time:
Hour: 9
Minute: 10
Input Arrival Time:
Hour: 16
Minute: 45

2. Delete Train.

1. List all the trains departed from a particular station.
2. List all the trains departed from a particular station at a particular time.
3. List all the trains departed from particular station within the next one hour of a given time.
4. List all the trains between a pair of start station and end station.
5. Edit train details.
6. Exit.

****INPUT DETAILS****
Depart Station: Prayagraj
14163         Sangam Express     Prayagraj     Meerut     10:31     21:17
14511         Nauchandi Express     Prayagraj     Saharanpur     10:15     23:10

1. List all the trains departed from a particular station.
2. List all the trains departed from a particular station at a particular time.
3. List all the trains departed from particular station within the next one hour of a given time.
4. List all the trains between a pair of start station and end station.
5. Edit train details.
6. Exit.

****INPUT DETAILS****
Depart Station: Prayagraj
Train Time:
Hour: 10
Minute: 15
14511         Nauchandi Express     Prayagraj     Saharanpur     10:15     23:10

1. List all the trains departed from a particular station.
2. List all the trains departed from a particular station at a particular time.
3. List all the trains departed from particular station within the next one hour of a given time.
4. List all the trains between a pair of start station and end station.
5. Edit train details.
6. Exit.

****INPUT DETAILS****
Depart Station: Prayagraj
Time:
Hour: 10
Minute: 10
14163         Sangam Express     Prayagraj     Meerut     10:31     21:17
14511         Nauchandi Express     Prayagraj     Saharanpur     10:15     23:10

1. List all the trains departed from a particular station.
2. List all the trains departed from a particular station at a particular time.
3. List all the trains departed from particular station within the next one hour of a given time.
4. List all the trains between a pair of start station and end station.
5. Edit train details.
6. Exit.

****INPUT DETAILS****
Depart Station: New Delhi