National University of Modern Languages
Programming Fundamentals
Project Based Learning
BSCE-I (Fall 2024)
Library Management System
Group Members:
Haleema Mushtaq (I-CE9244711)
Muqadas Masroor (I-CE9244732)
M. Irfan Khan Niazi (I-CE92447)
Farman Ullah (I-CE92447)
1
Library Management System Project
1. Introduction:
This project implements a Library Management System that facilitates efficient handling of
library operations such as book management, user management, issuing and returning books, and
keeping track of borrowed books. Written in C++, the program adopts a menu-driven approach
to ensure simplicity and user-friendliness.
2. Program Overview:
The Library Management System addresses the challenges librarians and library users face in
manually managing books and borrowing transactions. The software aims to minimize human
error and provide real-time access to the library's inventory. The program supports:
Adding books to the library inventory.
Adding available copies of existing books.
Searching for books by ID, title, or author.
Deleting books from the inventory.
Displaying all books in the library.
Exiting the system securely.
3. Application Domain and Customer Requirements:
Application Domain:
The Library Management System serves the domain of libraries in various environments such as
schools, colleges, universities, and public libraries. This domain includes the following
components:
Book Inventory Management: Storing and retrieving books based on their unique IDs.
User Management: Tracking the library members who can borrow and return books.
Transaction Handling: Managing book issues and returns in a way that avoids conflicts or
errors.
Accountability and Security: Ensuring each transaction (issue or return) is recorded,
promoting proper use of library resources.
2
Customer Requirements:
Functional Requirements:
Add Book: Admins can add new books by providing a title, author, and unique ID.
Add Available Book: Admins can update the quantity of an existing book in the inventory.
Search a Book: Locate books using criteria like ID, title, or author.
Delete a Book: Remove books permanently from the inventory.
Display Books: List of all books along with their details.
Exit: Safely terminate the program after all desired operations are completed.
Non-Functional Requirements:
Usability: The system should have a simple interface with clear navigation options.
Performance: Transactions should execute swiftly.
Scalability: The program should allow expansion to support additional features such as
advanced search filters, due-date management, or fines.
Reliability: The system should ensure no duplicate entries or transaction conflicts.
4. Methodology:
The Library Management System uses a procedural approach, guided by a sequential flow of
operations. Menu-driven navigation allows both librarians and users to interact with the system
effectively. Key modules include:
Add Book Module: Handles the addition of new books to the inventory.
Add Available Book Module: Updates the quantity of existing books.
Search Book Module: Facilitates book searches by ID, title, or author.
Delete Book Module: Validates and removes books from the system.
Display Books Module: Lists all books with their details and availability status.
Error Handling: Provides meaningful feedback for invalid inputs or actions, enhancing
reliability.
5. Flow Chart:
3
START
Display Main
Menu
Choose Action:
Add Book
Add Available Book
Search a Book
Delete a Book
Display Books/ Exit
Execute
Selected
Action
Yes No
Return to Exit
Menu
STOP
4
6. Execution Code and Results:
Features Executed:
Add a Book:
Available Book:
Search a Book:
5
Delete a Book:
Exiting the system:
7. Conclusion:
The Library Management System demonstrates the fundamental operations of a library in a
computerized environment. The project showcases:
1. Effective use of programming fundamentals such as data structures (vectors).
2. Logical flow and modular coding practices.
3. Integration of basic validations to ensure consistency and reliability.
This system provides a solid foundation for further enhancement. Possible extensions include
integrating a database for persistent storage, implementing a graphical user interface (GUI), and
6
adding features like book reservations or fine management. Such improvements would bring the
system closer to meeting the real-world demands of modern libraries.
8. CODE:
#include <iostream>
#include <string>
using namespace std;
struct Book {
string title;
string author;
string publication;
int quantity;
};
Book books[100];
int bookCount = 0;
void addBook()
{
cout<<"\n=============== Add Book==============\n";
cout<<"Enter book title: ";
[Link]();
getline(cin, books[bookCount].title);
cout<<"Enter book author: ";
getline(cin, books[bookCount].author);
cout<<"Enter book publication: ";
getline(cin, books[bookCount].publication);
cout<<"Enter book quantity: ";
cin>>books[bookCount].quantity;
7
bookCount++;
cout<<"\n Book added successfully!\n"; cout<<"======================\n";
}
void displayBooks()
{
if (bookCount == 0)
{
cout<<"\n============ No Books Available============\n";
cout<<"No books available in the library.\n"; cout<<"==================\n";
return;
}
cout<<"\n============== Available Books============\n";
for (int i = 0; i < bookCount; i++)
{
cout<<"\n Book " << (i + 1) << ":\n";
cout<<"---------------------\n";
cout<<"Title: " << books[i].title << endl;
cout<<"Author: " << books[i].author << endl;
cout<<"Publication: " << books[i].publication << endl;
cout<<"Quantity: " << books[i].quantity << endl;
cout<<"---------------------\n";
}
cout<<"================\n";
}
void searchBook()
{
string title;
8
cout<<"\n============== Search Book===============\n";
cout<<"Enter book title to search: ";
[Link]();
getline(cin, title);
for (int i = 0; i < bookCount; i++)
{
if (books[i].title == title)
{
cout<<"\n Book found!\n";
cout<<"---------------------\n";
cout<<"Title: " << books[i].title<<endl;
cout<<"Author: " << books[i].author<<endl;
cout<<"Publication: " << books[i].publication<<endl;
cout<<"Quantity: " << books[i].quantity<<endl;
cout<<"-------------------\n";
return ;
}
}
cout<<"\n Book not found!\n"; cout<<"==================\n";
}
void deleteBook()
{
string title;
cout<<"\n============= Delete Book============\n";
cout<<"Enter book title to delete: ";
[Link]();
getline(cin, title);
9
for (int i = 0; i < bookCount; i++)
{
if (books[i].title == title)
{
for (int j = i; j < bookCount - 1; j++)
{
books[j] = books[j + 1];
}
bookCount--;
cout<<"\n Book deleted successfully!\n";
cout<<"================\n";
return;
}
}
cout<<"\n Book not found!\n";
cout<<"================\n";
}
int main()
{
int choice;
while (true)
{
cout<<"\n========= Library Management System========\n";
cout<<"1. Add Book\n";
cout<<"2. Display Books\n";
cout<<"3. Search Book\n";
cout<<"4. Delete Book\n";
10
cout<<"5. Exit\n";
cout<<"==================\n";
cout<<"Enter your choice: ";
cin>>choice;
switch (choice)
{
case 1:
addBook();
break;
case 2:
displayBooks();
break;
case 3:
searchBook();
break;
case 4:
deleteBook();
break;
case 5:
cout<<"\n Exiting the system\n";
return 0;
default:
cout<<"\n Invalid choice. Please try again.\n";
break;
}
}
return 0;}
11