This project contains two fully functional versions of the Library Management System:
A terminal application with ANSI colour-coded menus, compiled and run using g++. No external dependencies required.
A graphical desktop application built using the Qt 6.10.2 framework with a full windowed interface, dialogs, and a custom theme.
Both versions share the same backend logic and implement identical OOP concepts and features.
WhatsApp.Video.2026-07-14.at.4.32.48.PM.mp4
- Make sure all source/header files are in the same folder
- Open terminal/command prompt in that folder
- Compile using g++:
# Windows (MinGW / g++)
g++ main.cpp menus.cpp -o library -std=c++14
# Linux / macOS
g++ main.cpp menus.cpp -o library -std=c++14- Run the executable:
# Windows
library.exe
# Linux / macOS
./libraryNote: ANSI colour codes require a colour-capable terminal. Recommended: Windows Terminal, VS Code Terminal, or Linux/macOS default terminal.
- Open Qt Creator
- Go to File β Open File or Project
- Navigate to
G2-7GUI/and selectCMakeLists.txt - When prompted, select the kit:
Desktop Qt 6.10.2 MinGW 64-bitβ click Configure Project - Press Ctrl+B to build and wait for it to finish
- Go to
G2-7GUI/build/Desktop_Qt_6_10_2_MinGW_64_bit-Debug/in File Explorer and locate the.exe - Copy the following files into the same folder as the
.exe:theme.qssbooks.txtusers.txtborrows.txtholds.txt
- Press Ctrl+R in Qt Creator to run, or double-click the
.exedirectly
cd path\to\G2-7GUI
mkdir build
cd build
cmake .. -G "MinGW Makefiles" -DCMAKE_PREFIX_PATH=C:\Qt\6.10.2\mingw_64
mingw32-makeThen copy theme.qss and .txt data files into the build output folder and run:
.\G2-7LibraryManagementSystem.exeNotes:
- Make sure Qt 6.10.2 MinGW kit is properly configured in Qt Creator before building
- All source and header files must remain in the same project folder
- After building, copy
theme.qssnext to the.exeβ the UI theme will not load otherwise- The program auto-generates data files on first run, but sample data files are included for convenience so the system can be tested immediately without manual data entry
| Field | Value |
|---|---|
| Username | Admin |
| Password | admin123 |
| File | Description |
|---|---|
globals.h |
Exceptions, color codes, validation, helper functions |
date.h |
Date structure and date arithmetic |
logger.h |
Logger class for timestamped action logging |
resource.h |
Abstract Resource class and Book derived class |
records.h |
BorrowRecord and HoldRecord classes |
user.h |
Account, Membership, and User classes |
admin.h |
Administrator class with full save/load cycle |
menus.h |
Menu function declarations |
menus.cpp |
Menu function implementations |
main.cpp |
Main driver program |
Build File
| File | Description |
|---|---|
CMakeLists.txt |
CMake project configuration file |
Backend (Logic Layer) β all implemented as header-only
| File | Description |
|---|---|
globals.h |
Exceptions, validation helpers, shared constants |
date.h |
Date struct with arithmetic (today, addDays) |
logger.h |
Static Logger for timestamped file logging |
resource.h |
Abstract Resource base class + Book subclass |
records.h |
BorrowRecord and HoldRecord classes |
user.h |
Account, Membership, and User classes |
admin.h |
Administrator class (catalog + user management, save/load cycle) |
Frontend (GUI Layer)
| File | Description |
|---|---|
theme.qss |
Qt stylesheet defining global colour scheme and UI theme |
main.cpp |
Qt application entry point |
mainwindow.h/.cpp |
Login screen for Admin and User |
adminwindow.h/.cpp |
Full admin dashboard |
userwindow.h/.cpp |
User dashboard |
addbookdialog.h/.cpp |
Modal dialog for adding a new book |
adduserdialog.h/.cpp |
Modal dialog for registering a new user |
registerdialog.h/.cpp |
Dialog for new user self-registration |
overduedialog.h/.cpp |
Dialog displaying overdue books with fines |
userstabledialog.h/.cpp |
Sortable table of all registered users |
Login Screen β Role selection (Admin/User), credential validation
Admin Window
- Book Management: Add, update, remove, search books
- User Management: Register users, view user table
- Circulation: Issue and return books
- Holds: Approve or reject hold requests
- Reports: Overdue report, issued books, customer statements
User Window
- Browse and search the book catalog
- Borrow and return books
- Place and view hold requests
- View borrow history and account balance
- Deposit funds and pay outstanding fines
- Membership upgrade option
The program automatically generates all data files on first run if they do not already exist. Sample data files are included in the project folder so the system can be tested immediately without manual data entry.
| File | Description |
|---|---|
books.txt |
Book catalog (sample books included) |
users.txt |
Registered users (sample users included) |
borrows.txt |
Borrowing transaction history |
holds.txt |
Hold/reservation records |
log.txt |
Timestamped system activity log (auto-generated) |
Book inherits all protected attributes and public methods from the abstract Resource class without redeclaring them.
resource.h β class Book : public Resource
Resource declares three pure virtual methods (input(), display(), serialize()) that every subclass must override.
resource.h β Resource::input(), display(), serialize() = 0
Book overrides all virtual methods using the override keyword. Administrator stores books as vector<unique_ptr<Resource>> and dispatches calls at runtime via the vtable.
resource.h β Book::input(), display(), serialize(), getGenre()
admin.h β showAllBooks(), saveBooks(), searchByGenre()
All attributes are private/protected. Critical state transitions locked behind dedicated methods: closeRecord(), markApproved(), payFine().
Complex logic hidden behind simple method names β addFine(), isExpired(), isOverdue(), calculateFine() expose clean interfaces with no internal arithmetic visible to callers.
User owns Account, Membership, vector<BorrowRecord>, and vector<HoldRecord> via unique_ptr. Administrator owns the full catalog and user list. All owned objects destroyed automatically with the parent.
user.h, admin.h
Book overloads operator== and operator!= to compare by ISBN. Used in Administrator::addBook() for duplicate detection.
resource.h β Book::operator==, Book::operator!=
Seven custom exception classes in globals.h, each inheriting std::exception:
InvalidInputException/InvalidIDException/NotFoundExceptionBorrowLimitException/DailyLimitExceptionOutstandingFineException/NotAvailableException
Every action wrapped in try-catch β failures display formatted errors instead of crashing.
All data persists via pipe-delimited text files. loadAll() enforces strict load order. Corrupted lines are caught and skipped. Logger writes timestamped entries at four severity levels.
User::nextRecordID and User::nextHoldID are static counters guaranteeing globally unique IDs. Resynced on startup via setNextRecordID() and setNextHoldID().
All records stored as unique_ptr inside User β automatic destruction with no manual delete anywhere in the system.
Console Version
- Administrator login and full admin panel (21 options)
- User self-registration and login
- ANSI colour-coded menus, receipts, and error banners
GUI Version
- Login screen with role-based routing (Admin / User)
- Full admin panel via dedicated Qt windows and dialogs
- User dashboard with full member workflow
Both Versions
- Add, update, remove, and search books (keyword, author, genre, year)
- Issue and return books with automatic due-date calculation
- Per-day fine calculation ($10/day), fine payment, wallet deposit
- Hold/reserve system with priority queue, 7-day expiry, admin approval, and automatic notification on return
- Membership upgrade (Basic β Silver β Gold) with limit enforcement
- Daily borrow cap (2 books/day) and concurrent borrow limit
- Outstanding fine block on borrowing
- Overdue report, currently issued report, customer report
- Full borrow history and account statement per user
- Data persistence across sessions (all four files)
- Timestamped logging to
log.txtat four severity levels
- No password masking β input visible on screen
- No multi-admin support β single administrator account only
- Only
Bookresource type implemented βJournal,DVDetc. architecturally supported via abstractResourcebut not yet developed - No database integration β plain-text file storage only
- No password encryption
- ANSI colours do not display on older Windows CMD (console version) β use Windows Terminal or VS Code Terminal
Books
- Object-Oriented Programming in C++ β Robert Lafore
- Programming Principles and Practice Using C++ β Bjarne Stroustrup
Websites
- cppreference.com β STL containers, unique_ptr, virtual functions
- cplusplus.com β Standard library reference
- learncpp.com β Inheritance, polymorphism, RAII
- geeksforgeeks.org β Concept examples and syntax reference
- w3schools.com/cpp β Quick C++ reference
- doc.qt.io/qt-6 β Qt 6 official documentation
- wiki.qt.io β Qt tutorials and examples
Tools
- Qt Creator Community 18.0.2 β IDE and GUI designer
- Qt 6.10.2 (MinGW 13.1.0 64-bit) β Framework and compiler
- Visual Studio Code β Code editor (console version)
- g++ (MinGW) β Compilation (console version)
- StarUML β UML class diagram design
- Claude AI β Debugging assistance, concept clarification, and documentation help