This is a C++ program for managing a library system. It allows users (students, faculty) to borrow and return books, manage fines, and view their borrowing history. Librarians can manage books and users in the system.
Use a C++ compiler to compile the program. For example:
g++ -o library_management.cppExecute the compiled program:
./library_management- Student: Can borrow up to 3 books for 15 days. Fines are charged at ₹10 per day for overdue books.
- Faculty: Can borrow up to 5 books for 30 days. No fines are charged.
- Librarian: Can add new books and users to the system.
- Add new books to the library.
- Delete a book from the library
- Borrow and return books.
- View the status of books (available/borrowed).
- Add new users (students, faculty, or librarians).
- Delete a User from the library
- View borrowed books and borrowing history.
- Pay fines (for students).
- Save and load library data to/from a file (
library.txt).
- When you run the program for the first time, it will load data from
library.txt.
When you run the program, you will see the following menu:
Who are you?
1. Student
2. Faculty
3. Librarian
4. ExitChoose your role by entering the corresponding number.
Menu Options:
1. Logout
2. Display all books
3. Display borrowed books
4. Borrow a book
5. Return a book
6. Show fines
7. Pay fines- Display all books: View all books in the library.
- Display borrowed books: View books you have borrowed.
- Borrow a book: Borrow a book by entering its title.
- Return a book: Return a book by entering its title.
- Show fines: View any fines you owe (for students only).
- Pay fines: Pay fines (for students only).
Menu Options:
1. Logout
2. Display all books
3. Display borrowed books
4. Borrow a book
5. Return a book- Display all books: View all books in the library.
- Display borrowed books: View books you have borrowed.
- Borrow a book: Borrow a book by entering its title.
- Return a book: Return a book by entering its title.
Menu Options:
1. Logout
2. Display all books
3. Add a book
4. Add a user
5. Delete a Book
6. Delete a User- Display all books: View all books in the library.
- Add a book: Add a new book to the library by entering its details.
- Add a user: Add a new user (student, faculty, or librarian) to the system.
- Delete a book: Deletes a book from the library by entering its ISBN.
- Add a user: Deletes a user (student, faculty, or librarian) from the system by entering their User ID.
Choose Exit from the main menu to save the library state and exit the program.
- Log in as a librarian.
- Choose Add a book.
- Enter the book details (title, author, publisher, year, ISBN).
- Log in as a student.
- Choose Borrow a book.
- Enter the title of the book you want to borrow.
- Log in as a student.
- Choose Return a book.
- Enter the title of the book you want to return.
- Log in as a student.
- Choose Show fines to view your fines.
- Choose Pay fines to pay the fines.
The program saves and loads data from a file named library.txt. The file format is as follows:
Book:Title,Author,Publisher,Year,ISBN,Status,BorrowDate,ReturnDateExample:
Book:Book1,Author1,Publisher1,2000,ISBN1,Borrowed,1739145600,1741533402User:Name,ID,Role,FineAmountExample:
User:Student1,S1,Student,0Borrowed Books:UserID,ISBNExample:
Borrowed Books:S1,ISBN1Borrowing History:UserID,ISBNExample:
Borrowing History:S1,ISBN1If you'd like to contribute to this project, feel free to:
- Report issues.
- Suggest new features.
- Submit pull requests.