A console-based Hospital Management System built using C++ and core Object-Oriented Programming (OOP) concepts.
This project simulates a real hospital workflow with separate interfaces for Admins, Doctors, and Patients, allowing appointment booking and management with persistent file storage.
- โ Add doctors
- โ Remove doctors
- โ Add patients
- โ Remove patients
- ๐ View all doctors
- ๐ View all patients
- โ Add appointment slots
- โ Remove slots
- ๐ View slot availability
- โ๏ธ Update personal details
- ๐ Search doctors by specialty
- ๐ View available slots
- โ Book appointments
- โ Cancel appointments
- ๐ View personal appointments
- โ๏ธ Update personal details
| Concept | How It Was Used |
|---|---|
| ๐ Encapsulation | Private/protected members with getters & setters |
| ๐งฌ Inheritance | Doctor, Patient, and Admin inherit from User |
| ๐ญ Polymorphism | Virtual functions like displayInfo() |
| ๐งฑ Abstraction | Pure virtual methods in User |
| ๐๏ธ Constructor Overloading | Multiple constructors in classes |
| ๐พ File Handling | Persistent storage using text files |
try-catch and throw statements |
|
| ๐งน Dynamic Memory | Arrays allocated using new[] and delete[] |
The base class for all users in the system.
- ID
- Username
- Password
- Authentication
- File handling
- Virtual methods for polymorphism
Derived from User.
- Managing doctors
- Managing patients
- Viewing records
Derived from User.
- Specialization
- Appointment slots
- Slot availability
- Managing slots
- Updating details
- Viewing appointments
Derived from User.
- Disease/complaint
- Age
- Searching doctors
- Booking appointments
- Cancelling appointments
Represents a booked appointment between a doctor and a patient.
- Appointment ID
- Doctor ID
- Patient ID
- Slot index
The system automatically saves and loads data using text files.
| File | Purpose |
|---|---|
doctors.txt |
Stores doctor records |
patients.txt |
Stores patient records |
appointments.txt |
Stores appointment records |
- Loaded automatically at startup
- Saved automatically before exit
Username: admin
Password: admin123
Doctors login using:
- Doctor ID
- Password
Patients login using:
- Patient ID
- Password
- Open the
.slnfile - Build the project
- Run using:
Ctrl + F5g++ main.cpp User.cpp Admin.cpp Doctor.cpp Patient.cpp Appointment.cpp -o hospital
./hospital- Login as admin
- Add doctors and patients
- Login using doctor ID
- Add appointment slots
- Login using patient ID
- Search doctors by specialty
- Book an available appointment
- โ Uses OOP principles extensively
- โ Uses polymorphism and abstraction
- โ Prevents double-booking slots
- โ Automatically frees slots after cancellation
- โ Handles invalid input safely
- โ Persistent file storage
- โ Modular and maintainable code design
The repository already contains sample:
- Doctors
- Patients
- Appointments
for easy testing and demonstration.
Possible future enhancements:
- ๐ฅ๏ธ GUI/Desktop Interface
- ๐๏ธ Database Integration
- ๐ Appointment scheduling by date
- ๐ Password encryption
- ๐ฑ Mobile or Web version
- ๐ Admin dashboards
- ๐ณ Billing system
- ๐ป C++
- ๐ง Object-Oriented Programming
- ๐พ File Handling
- โ๏ธ Dynamic Memory Allocation
- ๐ช Visual Studio
| Name | ID |
|---|---|
| Abdelrahman Nader | 25-105217 |
| Yassin Tamer | 25-103804 |
| Youssef Mohamed | 25-101800 |
| Seif El Sayed | 25-103665 |
| Abdelrahman Shady | 25-100322 |
๐ GitHub Profile:
https://github.com/YoussefOthman10
๐ Project Repository:
https://github.com/YoussefOthman10/HospitalManagementSystem