Skip to content

deepthishivani/hostel-cms-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hostel Complaint Management System

C++ Console Application | OODP Mini Project | 21CSC101T


Project Overview

A fully menu-driven C++ application for managing hostel maintenance complaints. Students can raise, track, and review complaints. The admin can view, search, filter, update status, assign staff, add remarks, and resolve or reject complaints. All data is stored in plain-text files so it persists across runs.


Folder Structure

hostel-cms-cpp/
│
├── Makefile
├── README.md
│
├── include/                       ← Header files (.h)
│   ├── User.h                     ← Abstract base class
│   ├── Student.h                  ← Inherits from User
│   ├── Admin.h                    ← Inherits from User
│   ├── Complaint.h                ← Entity: inline getters, friend fn,
│   │                                constructor overloading,
│   │                                operator overloading
│   ├── ComplaintManager.h         ← CRUD + file I/O
│   ├── AuthManager.h              ← Login/session + custom exceptions
│   └── UI.h                       ← Display helpers + inline functions
│
├── src/                           ← Source files (.cpp)
│   ├── main.cpp                   ← Entry point + all menu flows
│   ├── User.cpp
│   ├── Student.cpp
│   ├── Admin.cpp
│   ├── Complaint.cpp              ← All operator overloads + friend fn
│   ├── ComplaintManager.cpp       ← File I/O + CRUD
│   ├── AuthManager.cpp            ← Exception handling in login()
│   └── UI.cpp                     ← Terminal output + input helpers
│
├── data/
│   ├── users.txt                  ← User accounts
│   └── complaints.txt             ← All complaints (auto-updated)
│
└── build/                         ← Auto-created during compilation

Compile and Run (macOS / Linux)

# Step 1 — go to project folder
cd hostel-cms-cpp

# Step 2 — compile
make

# Step 3 — run
./hostel_cms

# One command
make run

# Clean build files
make clean

# Manual compile (macOS without make)
clang++ -std=c++17 -I include src/*.cpp -o hostel_cms

Login Credentials

Role Username Password
Student priya priya123
Student rahul rahul123
Admin admin admin123

OOP Concepts — Complete List

Concept File How it is used
Class & Object All .h / .cpp files User, Student, Admin, Complaint, ComplaintManager, AuthManager
Encapsulation All classes All data members are private; accessed via public methods
Inheritance Student.h, Admin.h Student and Admin inherit from User
Polymorphism (runtime) AuthManager.h, main.cpp User* pointer holds Student or Admin at runtime
Abstraction User.h getRoleLabel() is pure virtual (= 0)
Constructor Overloading Complaint.h / Complaint.cpp 3 constructors: default, partial (id+title), full
Operator Overloading Complaint.h / Complaint.cpp ==, !=, <, and << overloaded
Friend Function Complaint.h / Complaint.cpp printComplaintCard() accesses private members directly
Inline Functions Complaint.h, UI.h All 14 getters inline; clearScreen, pressEnter, printLine
Exception Handling AuthManager.h / .cpp, main EmptyCredentialsException, InvalidLoginException, FileLoadException
File Handling ComplaintManager.cpp ifstream / ofstream for complaints.txt and users.txt

Exception Classes (in AuthManager.h)

Exception When thrown
EmptyCredentialsException Username or password field left blank
InvalidLoginException Credentials do not match any user in file
FileLoadException data/users.txt cannot be opened on startup

Operator Overloads (in Complaint.h / Complaint.cpp)

Operator Meaning
== Two complaints are equal if their IDs match
!= Opposite of ==
< Earlier dateSubmitted = smaller
<< Prints one-line summary to any ostream

Constructor Overloads (in Complaint.h / Complaint.cpp)

Constructor Parameters Used when
Default none Loading complaint from file
Partial id, title Quick lookup or display only
Full all 10 fields Student raises a new complaint

About

Multi-file C++ application for managing hostel complaints, featuring OOP concepts, user authentication, complaint tracking, file persistence, search/filter functionality, exception handling, and Makefile-based builds.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors