Skip to content

ayush-jadaun/LibraryManagement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Library Management System (C++)

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.

Features

  • 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

How to Use

  1. Compile the code using a C++ compiler (e.g., g++).
  2. Run the executable.
  3. Use the main menu to select options:
    • 1 for Borrowing a Book
    • 2 for Returning a Book
    • 3 for Viewing Borrowed Records
    • 4 for Searching for a Book
    • 5 for Admin Panel (password: "admin123")
    • 6 to Exit
  4. Follow the prompts to complete your selected action.

Compilation & Execution

Using g++:

g++ -o library_system library_system.cpp
./library_system

Data Structures & Algorithms

The 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

Hash Table Benefits:

  • 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

Example Usage

****************************************
*                                      *
*      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!

Class Structure

  • 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

File Storage

The system uses two main files for persistence:

  • books.txt: Stores all available books
  • borrow_records.txt: Stores all active borrowing records

Each record is stored in a pipe-delimited format for easy parsing.

Personal Note

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.

Future Improvements

  • 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

License

This project is open-source. Feel free to modify and improve it!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages