The Train Management System is a C++ program designed to manage and organize train information. It allows users to efficiently perform operations such as adding, retrieving, updating, and removing train data while maintaining structured storage using binary search trees (BST).
-
Add Train
Add a new train to the list with its travel ID, engine number, capacity, and other details. -
Generate Random Train
Automatically generate a train with random attributes for testing purposes. -
Retrieve Train by ID
Search for a train by its travel ID and display its details. -
Retrieve Train by Engine Number
Search for a train by its engine number and display its details. -
Remove Train
Remove a train from the list using its travel ID. -
Display All Trains
View all trains currently in the system. -
Dynamic Balancing of Binary Search Trees
Ensures efficient searching by keeping the binary search trees balanced.
- Install a C++ compiler such as
g++
with support for C++11 or higher. - Use any operating system that supports C++ development (e.g., Linux, macOS, Windows).
-
Clone the repository:
git clone https://github.com/TechXplorerFR/cpp-data-structure.git cd cpp-data-structure
-
Compile the program:
g++ -o main main.cpp train.cpp binary_tree.cpp menu.cpp -std=c++11
-
Run the program:
./main
-
No Data Persistence
Train data is only stored in memory and will be lost once the program terminates. Adding file storage or database integration would address this limitation. -
Fixed Stations
Stations are predefined and cannot be dynamically input when adding a new train. -
Input Validation
There is no robust error handling for invalid inputs, such as entering letters when numeric values are expected. -
Duplicate Travel IDs
The program does not check for duplicate travel IDs during addition, which may result in inconsistencies.
-
Persistent Data Storage
Integrate file-based or database storage to maintain train data between program executions. -
Dynamic Station Input
Allow users to input custom stations for each train. -
Improved Input Validation
Add error-handling mechanisms to ensure robust input validation. -
Optimized Sorting Logic
Enhance the sorting logic to improve performance when dealing with large datasets. -
Extended Features
- Add sorting by other criteria, such as engine number or capacity.
- Provide options to export train data to a file.
This project is licensed under the MIT License.