This is the final project for the Fundamentals of Computer Programming (FCP) course at the University of Tehran. The project is a Student Management System that allows users to manage students, their courses, and grades using a SQLite database.
- CRUD Operations:
- Create, Read, Update, and Delete students and their courses.
- Database Integration:
- Uses SQLite to store student and course data.
- Migrations:
- Supports up migrations (applying changes) and down migrations (reverting changes).
- User-Friendly Interface:
- A command-line interface (CLI) for interacting with the system.
Before running the project, ensure you have the following installed:
- C++ Compiler:
g++or any C++17-compatible compiler.
- SQLite3:
- Install SQLite3 on your system.
- On Linux:
sudo apt install sqlite3 libsqlite3-dev - On macOS:
brew install sqlite3 - On Windows: Download from SQLite website.
- Make:
- Ensure
makeis installed on your system.
- Ensure
The project consists of the following files:
main.cpp:- The entry point of the application.
db.h:- Handles database connection, migrations, and SQL execution.
models.h:- Defines the data structures (
personandlesson) and database operations.
- Defines the data structures (
control.h:- Implements the user interface and application logic.
migrations/:- Contains SQL scripts for up migrations (e.g., creating tables).
down_migrations/:- Contains SQL scripts for down migrations (e.g., dropping tables).
Makefile:- Automates compilation, migration, and execution.
git clone https://github.com/your-username/student-management-system.git
cd student-management-systemUse the Makefile to compile the program:
make compileApply the up migrations to set up the database:
make migrateStart the application:
make runTo revert changes, apply the down migrations:
make downRemove the compiled executable and database file:
make clean-
Add a Student:
- Use the CLI to add a new student with their name, field of study (
reshte), and courses.
- Use the CLI to add a new student with their name, field of study (
-
Add a Course:
- Add courses for a student, including the course name, credit hours (
vahed), and grade.
- Add courses for a student, including the course name, credit hours (
-
Calculate Average:
- The system automatically calculates the student's average based on their courses.
-
View Students:
- View a list of students sorted by their average grade.
-
Edit or Delete:
- Edit or delete students and their courses.
The database consists of two tables:
| Column | Type | Description |
|---|---|---|
id |
INTEGER | Primary key (auto-increment) |
name |
TEXT | Student's name |
reshte |
TEXT | Field of study |
average |
REAL | Student's average grade |
| Column | Type | Description |
|---|---|---|
lesson_id |
INTEGER | Primary key (auto-increment) |
lesson_name |
TEXT | Course name |
student_id |
INTEGER | Foreign key (references person.id) |
vahed |
INTEGER | Credit hours |
grade |
REAL | Grade for the course |
- Located in the
migrations/directory. - Example:
001_create_tables.sqlcreates thepersonandlessontables.
- Located in the
down_migrations/directory. - Example:
001_drop_tables.sqldrops thepersonandlessontables.
This project is licensed under the MIT License. See the LICENSE file for details.
- University of Tehran: For providing the Fundamentals of Computer Programming (FCP) course.
- SQLite: For providing a lightweight and powerful database engine.
- Instructor and TAs: For their guidance and support throughout the course.
Enjoy using the Student Management System! 🚀