This is a comprehensive Library Management System implemented in C++ that supports book management, student borrowing records, and persistent storage through file I/O operations.
- Book Management: Add, remove, search, and display books
- Borrowing System: Track who borrowed which books
- Student Records: Maintain student information associated with borrowed books
- Admin Panel: Secured with password protection for administrative tasks
- Persistent Storage: Data saved to files for retrieval between sessions
- Efficient Lookups: Uses hash-based data structures for O(1) book retrieval
- Compile the code using a C++ compiler (e.g., g++).
- Run the executable.
- Use the main menu to select options:
1for Borrowing a Book2for Returning a Book3for Viewing Borrowed Records4for Searching for a Book5for Admin Panel (password: "admin123")6to Exit
- Follow the prompts to complete your selected action.
g++ -o library_system library_system.cpp
./library_systemThe system uses several key data structures and algorithms:
- Unordered Map (Hash Table): For O(1) book lookup by ID
- Vectors: For storing and managing borrow records
- Sorting Algorithm: Used to display books in order by ID
- String Search: Implemented for finding books by title keywords
- Constant-time O(1) lookups for books by their unique ID
- Efficient insertion and deletion operations
- Perfect for library systems where quick access by book ID is essential
****************************************
* *
* WELCOME TO THE LIBRARY SYSTEM *
* *
****************************************
Contact: ayushjadaun6@gmail.com | 9548999129
MAIN MENU:
1. Borrow a Book
2. Return a Book
3. View Borrowed Book Records
4. Search for a Book by Title
5. Admin Panel
6. Exit
Enter your choice: 1
Available Books in Library:
1. The Kite Runner by Khaled Hosseini (ID: 101)
2. To Kill A Mockingbird by Harper Lee (ID: 102)
3. The Alchemist by Paulo Coelho (ID: 103)
4. Pride And Prejudice by Jane Austen (ID: 104)
5. A Tale Of Two Cities by Charles Dickens (ID: 105)
Enter the Book ID to borrow: 103
Enter your name: John Doe
Enter your email: john@example.com
Book borrowed successfully!
- Book: Represents a book with ID, title, and author
- BookManager: Handles all book-related operations
- BorrowRecord: Represents a borrowed book and borrower details
- StudentManager: Manages student borrowing records
- LibrarySystem: Main interface class integrating all components
The system uses two main files for persistence:
books.txt: Stores all available booksborrow_records.txt: Stores all active borrowing records
Each record is stored in a pipe-delimited format for easy parsing.
I created this project during my early programming days and recently rediscovered it while going through old files. I never uploaded it to GitHub at the time as I wasn't familiar with Git version control, but I'm sharing it now as a memento of my programming journey.
While there are certainly improvements I would make now with more experience, this project represents an important milestone in my learning process.
- Implement a graphical user interface
- Use a relational database instead of text files
- Add due dates and overdue notifications
- Implement more advanced search capabilities
- Add unit tests for reliability
- Apply design patterns for better code organization
This project is open-source. Feel free to modify and improve it!