A robust, terminal-based Student Management System developed in C++. This project transitioned from procedural structs to a full Object-Oriented Programming (OOP) architecture. It is designed to safely handle large datasets with built-in fault tolerance.
- Safe File I/O & Exception Handling: Automatically parses
data.csvto load hundreds of student records. Usestry/catchblocks (std::invalid_argument,std::out_of_range) to gracefully skip corrupted or non-numeric CSV lines without crashing the program. - Input Buffer Clearing: Implemented robust
std::cinvalidation to prevent infinite loops when users input strings instead of numeric data. - Dynamic Semester Tracking: Maps courses to exact semesters based on cohort admission years using the
std::mapdata structure. - SOLID Principles: * Utility functions are isolated in static classes.
- Employs the Strategy Pattern for scalable sorting logic (currently sorts by Student ID via overloaded
<operator).
- Employs the Strategy Pattern for scalable sorting logic (currently sorts by Student ID via overloaded
📦 Quan_li_sinh_vien_class
┣ 📂 src
┃ ┣ 📄 Course.h # Represents a registered course
┃ ┣ 📄 main.cpp # Application entry point and UI loop
┃ ┣ 📄 Semester.h # Represents a semester containing multiple courses
┃ ┣ 📄 SortStrategy.h # Interface and concrete classes for Strategy Pattern
┃ ┣ 📄 Student.h # Student entity with overloaded operators
┃ ┣ 📄 StudentManager.h # Business logic and state management
┃ ┗ 📄 Utils.h # Utility classes (Date formatting, Validation)
┣ 📄 .gitignore # Specifies untracked compiled files
┣ 📄 data.csv # Sample dataset generated by the Python script
┣ 📄 generate_data.py # Python automation script to generate mock CSV data
┗ 📄 README.md # Project documentation
Upon execution, the system automatically attempts to read the data.csv file located in the root directory.
-
Auto-Loading: The terminal will display the number of successfully loaded students and report any skipped lines due to formatting errors.
-
Search Mode: Enter a valid 8-digit Student ID to retrieve the profile.
-
If found, specify the Semester Number (1-8) to view detailed transcripts (Course IDs, Credits, GPA).
-
Type any non-numeric character or an invalid semester to trigger the system's safe-fail warnings.
-
-
Exit: Type 0 when prompted for a Student ID to safely terminate the program.
- The included
data.csvmust follow this exact header structure (comma-separated):
MSSV,Khoa,HoTen,NgaySinh,ThuTuHocKy,TenHocKy,MaMon,TinChi,GPA
To demonstrate the system's ability to handle large datasets, a Python automation script (generate_data.py) is included in the root directory. This script dynamically generates a massive data.csv file containing hundreds of mock students with randomized but structurally accurate academic records.
- Ensure you have Python installed on your system.
- Open your terminal in the project root directory.
- Run the script:
python generate_data.py
(Note: Use python3 on macOS/Linux if required).
- The script will automatically output a fresh
data.csvfile, ready to be parsed by the C++ application. You can easily modify the num_students variable inside the Python file to stress-test the C++ application with thousands of records.