0% found this document useful (0 votes)
3 views40 pages

Project Report Sample

The document presents a project report on a 'Library System' developed using C programming by students from Kathmandu Model Secondary School as part of their Grade XII Computer Science curriculum. The system aims to automate library management tasks such as adding, issuing, and returning books, addressing the inefficiencies of traditional manual record-keeping. It includes features like user management, data storage using file handling, and a simple command-line interface, while also outlining its objectives, limitations, and potential for future enhancements.

Uploaded by

tejasjoshi099
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views40 pages

Project Report Sample

The document presents a project report on a 'Library System' developed using C programming by students from Kathmandu Model Secondary School as part of their Grade XII Computer Science curriculum. The system aims to automate library management tasks such as adding, issuing, and returning books, addressing the inefficiencies of traditional manual record-keeping. It includes features like user management, data storage using file handling, and a simple command-line interface, while also outlining its objectives, limitations, and potential for future enhancements.

Uploaded by

tejasjoshi099
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Government of Nepal

NATIONAL EXAMINATION BOARD


GRADE XII

KATHMANDU MODEL SECONDAY SCHOOL


BAGBAZAR, KATHMANDU

A Project Work on

Library System
using C-Programming

Submitted By

Ram Shrestha (Symbol No: 812343)


Shyam Yadav (Symbol No: 812385)
Sita Timilsina (Symbol No: 812225)
Faculty Name, XII - K

Magh 04, 2082


Kathmandu Nepal
Government of Nepal
NATIONAL EXAMINATION BOARD
GRADE XII

KATHMANDU MODEL SECONDAY SCHOOL


BAGBAZAR, KATHMANDU

LIBRARY SYSTEM

A project report submitted for the partial fulfillment of final examination


Computer Science, Faculty Name
Grade XII - K
2082

Assigned On Submitted On
10 Mangsir, 2082 04 Magh, 2082

Submitted By
Ram Shrestha (Symbol No: 812343)
Shyam Yadav (Symbol No: 812385) Submitted To
Sita Timilsina (Symbol No: 812225) Subject Teacher Name
Certificate of Project Assignment Authorization
This is to certify that the project “Library System,” assigned on 10 Mangsir, 2082, has been given to
the following students of Grade XII Computer Science as part of the +2 NEB curriculum requirements.
The project is to be completed and submitted according to the guidelines provided by the Department
of Computer Science.

This report must represent authentic work carried out by the students. The project demonstrates the
students’ understanding of programming concepts, system design, and development practices using the
C language.

This authorization certificate must be included in the report as an official acknowledgment of the
assigned project, to be kept after the cover page at the time of submission

Students:

 Mr. Ram Shrestha, XII - K, Symbol No: 812343

 Mr. Shyam Yadav, XII - K, Symbol No: 812385

 Miss Sita Timilsina, XII - K, Symbol No: 812225

Date: 14 Mangsir, 2082

Department of Computer Science


Kathmandu Model Secondary School (KMSS)
Acknowledgement
Designing and developing our project “Library System” has been a challenging yet rewarding
experience. It required continuous effort, teamwork, and valuable guidance from many people. We
would like to take this opportunity to express our sincere gratitude to everyone who supported us
throughout this journey.

First and foremost, we would like to thank Kathmandu Model Secondary School, our respected
Computer Science HOD, Mr. Saroj Poudel, along with all our respected faculty teachers, for
providing us with a sound academic environment and the necessary resources to complete this project
successfully.

Our deepest appreciation goes to our project guide Mr. Aryan Rai (Computer Faculty) for his constant
supervision, encouragement, and insightful suggestions that guided us in the right direction at every
stage of this project. His patience and expertise truly inspired us to do our best work.

We would also like to express our heartfelt thanks to our teachers Mrs. Sita Karki and Mr. Anil Thapa
for their valuable guidance and motivation throughout the development of this project.

A special mention goes to our friends Sujal Sharma, Anisha Gurung, and Rohan Adhikari, who
have been supportive, cooperative, and always ready to lend a helping hand whenever needed. Their
ideas, feedback, and teamwork played a crucial role in completing this project successfully.

We are deeply grateful to our parents for their endless love, care, and encouragement, which kept us
motivated throughout this journey. Without their constant support, this project would not have been
possible.

Finally, we would like to express our heartfelt gratitude to the National Examination Board (NEB)
for giving us the opportunity to work on this project and enhance our knowledge and skills in C
programming and system development.

Mr. Ram Shrestha


Mr. Shyam Yadav
Miss. Sita Timilsina
Abstract
Our project, “Library System”, is designed to make library management easier and more organized.
It helps in performing basic tasks like adding new books, issuing and returning them, and keeping track
of available records. The system is developed using the C programming language, applying concepts
such as file handling, arrays, functions, and structures to store and manage data efficiently. It features
a simple text-based interface that’s easy to use and understand. Through this project, we were able to
apply what we learned in programming to create a working system that is practical, reliable, and
user-friendly.
Acronym and Abbreviation
C : Programming Language Developed by Dennis Ritchie

IDE : Integrated Development Environment

I/O : Input / Output

EOF : End of File

ASCII : American Standard Code for Information Interchange

CPU : Central Processing Unit

RAM : Random Access Memory

ALU : Arithmetic Logic Unit

CLI : Command Line Interface

LIB : Library (Collection of Functions or Routines)

SRC : Source Code

OBJ : Object File

EXE : Executable File

FN : Function

VAR : Variable
Table of Contents
ACKNOWLEDGEMENT.………………………………………………………………….……………………………………………………………. I

ABSTRACT …………………………………………………………………………….……………………………………………………………………. II

ACRONYM AND ABBREVIATION ………………………………………………………………………………………………………………… III

1. INTRODUCTION ....................................................................................................................................... 1
1.1 Background Introduction ....................................................................................................................... 1
1.2 Problem Statement .................................................................................................................................. 1
1.3 Objectives ................................................................................................................................................. 1
1.4 Scope ......................................................................................................................................................... 2
1.5 Limitations ............................................................................................................................................... 2
1.6 Organization of The Report.................................................................................................................... 2
2. LITERATURE REVIEW ........................................................................................................................... 3
2.1 Study of Conventional System ................................................................................................................ 3
2.2 Purposed System ...................................................................................................................................... 3
2.2.1 Feature of the Proposed System: ............................................................................................................ 3
2.2.2 Implementation Area .............................................................................................................................. 4
3. REQUIREMENT SPECIFICATION AND ANALYSIS .......................................................................... 5
3.1 Feasibility Analysis .................................................................................................................................. 5
3.1.1 Operational Feasibility ............................................................................................................................ 5
3.1.2 Technical Feasibility ................................................................................................................................ 5
3.1.3 Economic Feasibility ............................................................................................................................... 5
3.2 System Planning....................................................................................................................................... 5
3.2.1 System Life Cycle Development Methods ............................................................................................. 6
3.2.2 Recommended System Requirements .................................................................................................... 7
4. SYSTEM DESIGN, DEVELOPMENT AND TESTING ......................................................................... 8
4.1 System Design .......................................................................................................................................... 8
4.1.1 Modular Structure of the System ........................................................................................................... 8
4.1.2 File Design ................................................................................................................................................ 8
4.1.3 Data Flow and Process Design ................................................................................................................ 9
4.1.4 User Interface Design .............................................................................................................................. 9
4.1.5 Algorithmic Overview ............................................................................................................................. 9
4.1.6 Detailed Algorithms................................................................................................................................. 9
4.2 System Development ............................................................................................................................. 11
4.2.1 Development Methodology ................................................................................................................... 11
4.2.2 System Used for Development .............................................................................................................. 11
4.2.3 Programming Language ....................................................................................................................... 11
4.2.4 Data Dictionary...................................................................................................................................... 12
[Link] Data Structures Used ........................................................................................................................ 12
[Link] Files Used ........................................................................................................................................... 12
4.2.5 Source Code ........................................................................................................................................... 13
4.3 System Testing ....................................................................................................................................... 21
4.3.1 Unit Testing ............................................................................................................................................ 22
4.3.2 Module Testing ...................................................................................................................................... 22
4.3.3 System Testing ....................................................................................................................................... 22
4.3.4 Test Cases ............................................................................................................................................... 22
5. RECOMMENDATION, FUTURE ENHANCEMENT AND CONCLUSION .................................... 24
5.1 Future Enhancement ............................................................................................................................. 24
5.2 Conclusion .............................................................................................................................................. 24
BIBLIOGRAPHYAND REFERENCES .......................................................................................................... 25
USER MANUAL AND SNAPSHOTS .............................................................................................................. 26
Team Contribution ............................................................................................................................................. 30
List of Figures
Figure 1 Structure of Report ............................................................................................................................... 2
Figure 2 Linear Sequential Model ....................................................................................................................... 6
Figure 3 Main Menu ........................................................................................................................................... 26
Figure 4 Admin Login ........................................................................................................................................ 26
Figure 5 Admin Menu ........................................................................................................................................ 27
Figure 6 Add Book .............................................................................................................................................. 27
Figure 7 Search Book ......................................................................................................................................... 28
Figure 8 Issue Book ............................................................................................................................................ 28
Figure 9 List of All Books .................................................................................................................................. 29
Figure 10 Return Books ..................................................................................................................................... 29
List of Tables
Table 1 Files for Storage ...................................................................................................................................... 8
Table 2 File Data ................................................................................................................................................. 12
Table 3 Test for User Login ............................................................................................................................... 22
Table 4 Test for Adding a New Book Record ................................................................................................... 22
Table 5 Test for Searching a Book .................................................................................................................... 23
Table 6 Test for Issuing a Book ......................................................................................................................... 23
Table 7 Test for Returning a Book .................................................................................................................... 23
Table 8 Test for Viewing All Books................................................................................................................... 23
“Library System”

Chapter I

1. INTRODUCTION
1.1 Background Introduction

The project entitled “Library System” is a console-based application developed using the C
programming language. The system is designed to manage and organize library operations efficiently.
It allows users to perform essential tasks such as adding new books, recording readers’ information,
issuing and returning books, and viewing records according to different categories.

The project is completely based on file handling in C, where all the data such as book details, reader
information, and transaction records is stored and managed using external files. This ensures data
persistence even after the program is closed.

The system includes two types of users: Librarian (Admin) and Readers. The librarian can perform all
operations such as managing books, maintaining issue and return records, and viewing information
category-wise. Readers can access basic information about available books. The system provides a
simple, menu-driven interface to make operations easy and understandable.

Main Features of the System

 Add, view, update, and delete book records


 Manage readers’ data
 Issue and return books with proper record keeping
 Categorize books by subject or genre
 Maintain records using file handling for long-term storage

1.2 Problem Statement

In many traditional libraries, records of books and readers are maintained manually in registers or
notebooks. This manual process is time-consuming, error-prone, and difficult to manage when the
number of books and readers increases. Searching for a specific book or tracking which book has been
issued to which reader becomes complicated.

Moreover, manual systems do not provide quick updates or easy access to information. There is a high
chance of data loss, duplication, or inconsistency. To overcome these issues, a computerized Library
System using C programming has been proposed to automate record keeping and make library
management faster, easier, and more accurate.

1.3 Objectives

The main objective of this project is to develop a simple yet efficient computerized system for managing
library records using the C programming language.

Page | 1
“Library System”

 To maintain records of all books available in the library.


 To keep track of books issued and returned by readers.
 To store and manage readers’ details systematically.
 To categorize books according to subjects or genres.
 To apply C programming concepts such as file handling, structures, and functions for data
management.
 To minimize manual work and reduce human errors in record keeping.

1.4 Scope

 This project can be implemented in small or medium-sized libraries where computerization is


required but the use of complex databases is unnecessary.
 It can be expanded in the future to include additional features such as password-protected
admin login, fine calculation for late returns, search functionality, and even database
integration.
 Overall, this system provides a strong foundation for understanding how file handling and
data management can be effectively used in practical applications through C programming.

1.5 Limitations

 The system runs in a command-line interface (CLI) only, with no graphical user interface.
 It is single-user based; multi-user access is not supported.
 Data is stored in text files, so large-scale data management may be limited.
 No online or network-based access is available.
 Fine calculation and advanced search features are not implemented in this version.

These limitations can be addressed and improved in future versions of the system.

1.6 Organization of The Report


Introduction Literature Review

Requirement
Specification &
Analysis

System Design & Development

Recommendation &
Testing Conclusion

Figure 1 Structure of Report

Page | 2
“Library System”

Chapter II

2. LITERATURE REVIEW
2.1 Study of Conventional System

In the conventional library system, all operations such as maintaining records of books, readers, and
book transactions are carried out manually. The librarian records details like book titles, author names,
issued and returned books, and reader information in registers or notebooks.

This manual process is time-consuming, prone to errors, and becomes difficult to manage when the
number of books and readers increases. Searching for a specific book or finding the details of who has
borrowed a book takes significant effort. Moreover, manual record-keeping increases the risk of data
loss, duplication, and inconsistencies.

To overcome these drawbacks and improve efficiency, a computerized system is essential. The Library
System is developed to simplify and automate these operations using file handling techniques in the C
language.

2.2 Purposed System

The proposed system is a C-based application designed to handle daily library operations digitally. It
allows the librarian to manage book records, reader information, and book transactions such as issue
and return.

All data is stored in external files, ensuring that the records remain available even after the program is
closed. The system eliminates the need for manual record-keeping and provides quick access to
information, making library management easier, faster, and more accurate.

Key Advantages of the Proposed System

 Automates the process of recording and managing books and readers.


 Reduces manual errors and saves time.
 Provides accurate and organized information storage using file handling.
 Ensures data can be easily retrieved and updated when needed.

2.2.1 Feature of the Proposed System:

 Key Advantages of the Proposed System


 Automates the process of recording and managing books and readers.
 Reduces manual errors and saves time.
 Provides accurate and organized information storage using file handling.
 Ensures data can be easily retrieved and updated when needed.

Page | 3
“Library System”

2.2.2 Implementation Area

This system can be implemented in schools, colleges, or small libraries where computerization is
required but the use of complex databases is unnecessary. It is suitable for institutions looking for a
low-cost, efficient solution to manage their library records digitally through C programming and file
handling.

Page | 4
“Library System”

Chapter III

3. REQUIREMENT SPECIFICATION AND ANALYSIS


3.1 Feasibility Analysis
3.1.1 Operational Feasibility

Operational feasibility examines whether the system will operate effectively once developed. The
Library System provides a simple and user-friendly environment through a command-line interface. It
allows librarians to manage records of books and readers efficiently without any technical complexity.

The system’s menu-driven structure makes it easy to navigate, even for users with minimal computer
knowledge. With a short initial training, the librarian can perform all operations such as adding books,
issuing and returning books, and viewing records easily. Therefore, the system is considered
operationally feasible for real-world use in small library environments.

3.1.2 Technical Feasibility

Technical feasibility evaluates whether the proposed system can be developed with the available
technical resources. The Library System is developed using the C programming language, which runs
efficiently on any standard computer without the need for additional software or complex hardware.

It utilizes basic file-handling operations to store data, ensuring that information remains available even
after the program is closed. Since it requires only a text editor and a C compiler, such as Turbo C or
Dev C++, it is highly feasible from a technical perspective. The system is lightweight, efficient, and
easy to maintain.

3.1.3 Economic Feasibility

Economic feasibility analyzes the cost-effectiveness of the system. The Library System is economical
because it requires minimal hardware and software resources. No expensive servers, databases, or
licenses are needed.

It helps reduce manual effort, saves time, and minimizes paperwork, making library operations more
efficient. As it can be implemented using existing computer systems, there are no additional costs
involved. Therefore, the system is highly economically feasible and suitable for educational institutions
and small libraries.

3.2 System Planning

System planning involves identifying user requirements, understanding existing problems, and
designing a proper plan for system development. The main goal of system analysis is to study the current
manual library management process and identify areas where automation can improve efficiency and
accuracy.

Page | 5
“Library System”

During the requirement analysis phase, the needs of the librarian were studied carefully to define the
functional requirements such as adding, issuing, returning, and categorizing books and non-functional
requirements such as simplicity, reliability, and ease of use.

Clear communication between the users and the developers ensured that the final system meets all user
expectations. Proper analysis and planning helped in designing a system that is practical, effective, and
user-friendly.

3.2.1 System Life Cycle Development Methods

The Library System has been developed using the Linear Sequential Model (Waterfall Model) of
software development. This model follows a systematic, step-by-step process where each phase must
be completed before moving on to the next.

Figure 2 Linear Sequential Model

The stages involved are:

System Analysis: Understanding the existing manual system and identifying the requirements for
automation.

System Design: Creating the structure and flow of the system, including data organization and user
interface design.

Coding: Implementing the design using the C programming language.

Testing: Verifying that all functions such as adding, issuing, and returning books work correctly.

Implementation and Maintenance: Deploying the system and maintaining it as needed.

This model ensures a clear development process, reduces confusion, and helps produce a stable and
functional system.

Page | 6
“Library System”

3.2.2 Recommended System Requirements

Hardware Requirements

 Processor: Intel Pentium IV or higher


 RAM: Minimum 2 GB (4 GB recommended)
 Hard Disk: Minimum 100 MB of free space
 Display: Standard VGA Monitor or higher
 Keyboard & Mouse: Standard input devices

Software Requirements

 Operating System: Windows, Linux, or any OS supporting a C compiler


 Programming Language: C
 Compiler/IDE: Turbo C / Dev C++ / Sublime Text (any one)
 Text Editor: Notepad or any text-based editor for viewing files

Page | 7
“Library System”

Chapter IV

4. SYSTEM DESIGN, DEVELOPMENT AND TESTING


4.1 System Design

System design is one of the most important phases in software development, where the logical structure
and working mechanism of the system are planned before actual coding. In this project, the Library
System has been designed using a modular programming approach to make the code organized,
maintainable, and easy to understand.

Since the system is based on file handling, all data related to books and readers are stored in external
text files instead of using a database. The design focuses on creating efficient structures, functions, and
file operations to handle library records.

4.1.1 Modular Structure of the System

The program is divided into several modules, where each module performs a specific task.
The main modules of the system are:

1. Main Module – Displays the main menu and allows users to navigate between features.
2. Book Management Module – Handles adding, viewing, updating, and deleting book records.
3. Reader Management Module – Manages reader information such as name, ID, and contact
details.
4. Issue/Return Module – Keeps track of which book has been issued to which reader and when
it is returned.
5. Search Module – Allows searching for books or readers based on category, title, or ID.
6. File Handling Module – Manages reading from and writing to files to ensure data is saved
permanently.

Each module interacts with others through function calls, ensuring smooth data flow and minimal
redundancy.

4.1.2 File Design

Since this system uses files for storage, the file design defines how data is stored and retrieved. The
project uses three main files:

File Name Purpose


[Link] Stores details of all books (Book ID, Title, Author, Category, Status)
[Link] Stores details of all registered readers (Reader ID, Name, Contact Info)
Keeps records of issued and returned books (Book ID, Reader ID, Issue Date,
[Link]
Return Date)

Table 1 Files for Storage

Page | 8
“Library System”

Each record is stored in a structured format, using delimiters or structures in binary/text mode to ensure
easy access and update.

4.1.3 Data Flow and Process Design

The system follows a linear flow of operations. A typical process, such as issuing a book, works as
follows:

1. The librarian selects “Issue Book” from the main menu.


2. The system checks if the book exists and is available.
3. It verifies the reader’s details.
4. If both conditions are met, a transaction record is written to [Link].
5. The book status is updated to “Issued” in [Link].

Similarly, the return process updates the status of the book and records the return date. This flow
ensures accuracy and consistency in file-based data management.

4.1.4 User Interface Design

The user interface of the system is text-based and menu-driven, developed using standard input/output
functions (printf, scanf, gets, etc.). It displays clear instructions and prompts to help the librarian
perform operations easily. The design focuses on simplicity, clarity, and minimal user errors.

4.1.5 Algorithmic Overview

The core logic of the system is designed using standard programming techniques such as:

 Loops and conditional statements for menu navigation and validations.


 Functions for modularity and reusability of code.
 Structures (struct) for grouping related data like book or reader information.
 File handling functions (fopen, fprintf, fscanf, fread, fwrite, etc.) for storing and retrieving data.

These algorithmic elements ensure that the system is efficient, easy to debug, and scalable for future
improvements.

4.1.6 Detailed Algorithms

a) Login System

1. Start
2. Display "Enter Username" and take input
3. Display "Enter Password" and take input
4. Compare input with stored admin username and password
5. If both match → Login Successful
6. Else → Display error message
7. End

Page | 9
“Library System”

b) Main Menu

1. Start
2. Display list of options
3. Take user choice
4. Call the respective function
5. Repeat until user chooses Exit
6. End

c) Add Book

1. Start
2. Display "Enter Username" and take input
3. Display "Enter Password" and take input
4. Compare input with stored admin username and password
5. If both match → Login Successful
6. Else → Display error message
7. End

d) Search Book

1. Start
2. Display "Enter Username" and take input
3. Display "Enter Password" and take input
4. Compare input with stored admin username and password
5. If both match → Login Successful
6. Else → Display error message
7. End

e) Issue Book

1. Start
2. Display "Enter Username" and take input
3. Display "Enter Password" and take input
4. Compare input with stored admin username and password
5. If both match → Login Successful
6. Else → Display error message
7. End

f) Return Book Algorithm & Pseudocode

1. Start
2. Display "Enter Username" and take input
3. Display "Enter Password" and take input
4. Compare input with stored admin username and password
5. If both match → Login Successful
6. Else → Display error message
7. End

g) View All Books

1. Start

Page | 10
“Library System”

2. Display "Enter Username" and take input


3. Display "Enter Password" and take input
4. Compare input with stored admin username and password
5. If both match → Login Successful
6. Else → Display error message
7. End

4.2 System Development


4.2.1 Development Methodology

The Library System was developed following the Linear Sequential Model (Waterfall Model), which
ensures systematic progress through the stages of analysis, design, coding, testing, and implementation.
Each phase was completed before moving on to the next to minimize errors and ensure a stable system.

4.2.2 System Used for Development

Hardware Requirements

 Processor: Intel Core i3 or higher


 RAM: Minimum 2 GB (4 GB recommended)
 Hard Disk: Minimum 100 MB of free space
 Display: Standard VGA or higher
 Input Devices: Keyboard and Mouse

Software Requirements

 Hardware Requirements
 Processor: Intel Core i3 or higher
 RAM: Minimum 2 GB (4 GB recommended)
 Hard Disk: Minimum 100 MB of free space
 Display: Standard VGA or higher
 Input Devices: Keyboard and Mouse

4.2.3 Programming Language

The system is developed entirely in the C programming language using procedural programming
techniques.
It utilizes:

 Functions for modular design


 Structures for grouping related data
 File handling (fopen, fclose, fprintf, fscanf, etc.) for persistent data storage
 Conditional statements and loops for logic and control flow

The program is written in a text-based environment, with all user interactions handled through a menu-
driven console interface.

Page | 11
“Library System”

4.2.4 Data Dictionary

In the Library System, all the information is stored and managed using files and structures. The data
dictionary for this system represents the variables, structures, and file records used to hold information
about books, readers, and transactions.

[Link] Data Structures Used

1. Structure for Book Record

struct Book {
int book_id;
char title[50];
char author[50];
char category[30];
int isIssued; // 0 = available, 1 = issued
};

2. Structure for Reader Record

struct Reader {
int reader_id;
char name[50];
char contact[30];
};

3. Structure for Transaction Record

struct Transaction {
int book_id;
int reader_id;
char issue_date[15];
char return_date[15];
};

[Link] Files Used

File Name Purpose Contents


Book ID, Title, Author, Category,
[Link] Stores details of all books
Availability
[Link] Stores reader details Reader ID, Name, Contact
Records of issued and returned
[Link] Book ID, Reader ID, Issue/Return Date
books

Table 2 File Data

Page | 12
“Library System”

4.2.5 Source Code


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BOOK_FILE "[Link]"
#define TRANSACTION_FILE "[Link]"

struct Book {
int book_id;
char title[50];
char author[50];
char category[30];
int isIssued;
};

struct Transaction {
int book_id;
int reader_id;
char issue_date[15];
char return_date[15];
};

void mainMenu();
int login();
void addBook();
void searchBook();
void issueBook();
void returnBook();
void viewBooks();

int main() {
int choice;
char ch = '0';
char dec;
char confirm[3];
int validInput = 0;

while (1) {
printf("\n===== LIBRARY MANAGEMENT SYSTEM =====\n");
mainMenu();
while(1){
printf("\nSelect your choice: ");
if (scanf(" %c", &ch) != 1 || (ch < '1' || ch > '3')) {
while (getchar() != '\n');

Page | 13
“Library System”

printf("\nInvalid choice. Please enter a valid


option (1, 2, or 3).\n");
continue;
}
break;
}
int direct_menu = 1;
switch(ch){
case '1':
system("cls");
if (login()){
while(direct_menu){
system("cls");
printf("\n===== LIBRARY MANAGEMENT SYSTEM
=====\n");
printf("\n======== ADMIN MENU
========\n");
printf("1. Add Book\n");
printf("2. Search Book\n");
printf("3. Issue Book\n");
printf("4. Return Book\n");
printf("5. View All Books\n");
printf("6. Return to Main Menu\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
addBook();
break;
case 2:
searchBook();
break;
case 3:
issueBook();
break;
case 4:
returnBook();
break;
case 5:
viewBooks();
printf("\nPress Enter to
return...");
getchar();
getchar();
break;
case 6:

Page | 14
“Library System”

printf("Do you want to return to the


main menu? (y/n): ");
while (getchar() != '\n');
fgets(confirm, sizeof(confirm),
stdin);
confirm[strcspn(confirm, "\n")] =
'\0';

if (confirm[0] == 'y' || confirm[0]


== 'Y') {
printf("Returning to main
menu...\n");
validInput = 1;
Sleep(2000);
system("cls");
direct_menu = 0;
break;
} else if (confirm[0] == 'n' ||
confirm[0] == 'N') {
printf("Staying in the same
Menu.\n");
validInput = 1;
Sleep(2000);
system("cls");
break;
} else {
printf("Invalid input. Please
enter 'y' or 'n'.\n");
Sleep(2000);
break;
}
break;
default:
printf("Invalid choice. Try
again.\n");
return;
}
}
}
break;
case '2':
while(direct_menu){
system("cls");
printf("\n===== LIBRARY MANAGEMENT SYSTEM
=====\n");
printf("\n======== READERS MENU ========\n");
printf("1. Search Book\n");
printf("2. View All Books\n");
printf("3. Return to Main Menu\n");

Page | 15
“Library System”

printf("Enter your choice: ");


scanf("%d", &choice);
switch (choice) {
case 1:
searchBook();
break;
case 2:
viewBooks();
printf("\nPress Enter to return...");
getchar();
getchar();
break;
case 3:
printf("Do you want to return to the main
menu? (y/n): ");
while (getchar() != '\n');
fgets(confirm, sizeof(confirm), stdin);
confirm[strcspn(confirm, "\n")] = '\0';
if (confirm[0] == 'y' || confirm[0] ==
'Y') {
printf("Returning to main
menu...\n");
validInput = 1;
Sleep(2000);
system("cls");
direct_menu = 0;
break;
} else if (confirm[0] == 'n' || confirm[0]
== 'N') {
printf("Staying in the same
Menu.\n");
validInput = 1;
Sleep(2000);
system("cls");
break;
} else {
printf("Invalid input. Please enter
'y' or 'n'.\n");
Sleep(2000);
break;
}
break;
default:
printf("Invalid choice. Try again.\n");
Sleep(2000);
break;
}
}

Page | 16
“Library System”

break;
case '3':
system("cls");
printf("\nAre you sure you want to exit?(Y/N) ");
scanf(" %c", &dec);
if (dec == 'Y' || dec == 'y'){
printf("\n\nThank you for using the library
managment system.\n");
exit(0);
}else{
printf("\nReturning to Main Menu....\n");
Sleep(2000);
system("cls");
break;
}
default:
printf("Invalid choice. Try again.\n");
printf("Press Enter to continue...");
Sleep(2000);
system("cls");
return;
}
ch = '0';
}
return 0;
}

// ------------------ MENU FUNCTION ------------------


void mainMenu(){
printf("\n======== MAIN MENU ========\n\n");
printf("\nPlease Select the User Type: \n");
printf("\n\t1: User - Librarian (Admin)\n");
printf("\t2: User - Readers\n");
printf("\t3: Exit\n");
printf("\n================================\n");
}

// ------------------ LOGIN FUNCTION ------------------


int login() {
char username[20], password[20];
printf("\n--- LOGIN REQUIRED ---\n");
printf("Enter Username: ");
scanf("%s", username);
printf("Enter Password: ");
scanf("%s", password);

Page | 17
“Library System”

if (strcmp(username, "admin") == 0 && strcmp(password, "admin") ==


0) {
printf("Login Successful!\n");
Sleep(2000);
return 1;
} else {
printf("Invalid Username or Password!\n");
return 0;
}
}

// ------------------ ADD BOOK ------------------


void addBook() {
system("cls");
FILE *fp = fopen(BOOK_FILE, "a");
if (!fp) {
printf("Error opening file!\n");
return;
}
struct Book b;
printf("\n---- ADD BOOKS ----\n");
printf("\nEnter Book ID: ");
scanf("%d", &b.book_id);
printf("Enter Title: ");
scanf(" %[^\n]", [Link]);
printf("Enter Author: ");
scanf(" %[^\n]", [Link]);
printf("Enter Category: ");
scanf(" %[^\n]", [Link]);
[Link] = 0;
fprintf(fp, "%d|%s|%s|%s|%d\n", b.book_id, [Link], [Link],
[Link], [Link]);
fclose(fp);
printf("Book added successfully!\n");
printf("\nReturning to the Admin Menu.\n");
Sleep(2000);
}

// ------------------ SEARCH BOOK ------------------


void searchBook() {
system("cls");
FILE *fp = fopen(BOOK_FILE, "r");
if (!fp) {
printf("Books file not found!\n");
return;
}

Page | 18
“Library System”

int id;
printf("\n---- SEARCH BOOKS ----\n");
printf("Enter Book ID to search: ");
scanf("%d", &id);
struct Book b;
int found = 0;
while (fscanf(fp, "%d|%49[^|]|%49[^|]|%29[^|]|%d\n",&b.book_id,
[Link], [Link], [Link], &[Link]) != EOF) {
if (b.book_id == id) {
printf("\nBook Found:\n");
printf("ID: %d\nTitle: %s\nAuthor: %s\nCategory:
%s\nStatus:%s\n", b.book_id, [Link], [Link], [Link],[Link] ?
"Issued": "Available");
found = 1;
}
}
if (!found)
printf("Book not found!\n");
fclose(fp);
printf("\nPress Enter to continue...");
getchar();
}

// ------------------ ISSUE BOOK ------------------


void issueBook() {
system("cls");
int id, reader;
char date[15];
printf("\n---- ISSUE BOOKS ----\n");
printf("Enter Book ID to issue: ");
scanf("%d", &id);
printf("Enter Reader ID: ");
scanf("%d", &reader);
printf("Enter Issue Date (dd/mm/yyyy): ");
scanf("%s", date);
FILE *fp = fopen(BOOK_FILE, "r");
FILE *temp = fopen("[Link]", "w");
struct Book b;
int found = 0;
while (fscanf(fp, "%d|%49[^|]|%49[^|]|%29[^|]|%d\n", &b.book_id,
[Link], [Link], [Link], &[Link]) != EOF) {
if (b.book_id == id && [Link] == 0) {
[Link] = 1;
found = 1;
}
fprintf(temp, "%d|%s|%s|%s|%d\n", b.book_id, [Link],
[Link], [Link], [Link]);

Page | 19
“Library System”

}
fclose(fp);
fclose(temp);
remove(BOOK_FILE);
rename("[Link]", BOOK_FILE);

if (found) {
FILE *tf = fopen(TRANSACTION_FILE, "a");
struct Transaction t;
t.book_id = id;
t.reader_id = reader;
strcpy(t.issue_date, date);
strcpy(t.return_date, "-");
fprintf(tf, "%d|%d|%s|%s\n", t.book_id, t.reader_id,
t.issue_date, t.return_date);
fclose(tf);
printf("Book issued successfully!\n");
printf("\nReturning to the Admin Menu.\n");
Sleep(2000);
} else {
printf("Book not available or not found!\n");
}
}

// ------------------ RETURN BOOK ------------------


void returnBook() {
system("cls");
int id;
char date[15];
printf("\n---- RETURN BOOKS ----\n");
printf("Enter Book ID to return: ");
scanf("%d", &id);
printf("Enter Return Date (dd/mm/yyyy): ");
scanf("%s", date);
FILE *fp = fopen(BOOK_FILE, "r");
FILE *temp = fopen("[Link]", "w");
struct Book b;
int found = 0;
while (fscanf(fp, "%d|%49[^|]|%49[^|]|%29[^|]|%d\n",
&b.book_id, [Link], [Link], [Link], &[Link]) !=
EOF) {

if (b.book_id == id && [Link] == 1) {


[Link] = 0;
found = 1;
}

Page | 20
“Library System”

fprintf(temp, "%d|%s|%s|%s|%d\n", b.book_id, [Link],


[Link], [Link], [Link]);
}

fclose(fp);
fclose(temp);
remove(BOOK_FILE);
rename("[Link]", BOOK_FILE);

if (found) {
printf("Book returned successfully!\n");
printf("\nReturning to the Admin Menu.\n");
Sleep(2000);
} else {
printf("Book was not issued or not found!\n");
}
}

// ------------------ VIEW ALL BOOKS ------------------


void viewBooks() {
system("cls");
FILE *fp = fopen(BOOK_FILE, "r");
if (!fp) {
printf("Books file not found!\n");
return;
}
struct Book b;
printf("\n---- LIST OF ALL BOOKS ----\n");
while (fscanf(fp, "%d|%49[^|]|%49[^|]|%29[^|]|%d\n", &b.book_id,
[Link], [Link], [Link], &[Link]) != EOF) {
printf("ID: %d | Title: %s | Author: %s | Category: %s |
Status: %s\n", b.book_id, [Link], [Link], [Link], [Link] ?
"Issued" : "Available");
}
fclose(fp);
}

4.3 System Testing

Testing is a crucial part of software development that ensures the system performs as expected. he
testing process helps detect and correct errors in logic, data handling, and functionality before the final
implementation.

Several testing phases were carried out to ensure the accuracy and stability of the Library System (C
Programming).

Page | 21
“Library System”

4.3.1 Unit Testing

Each function and module, such as Add Book, Issue Book, Return Book, and Search Book, was tested
individually to ensure they worked correctly. Unit testing helped verify that all input and output
operations were handled properly.

4.3.2 Module Testing

After verifying individual functions, each system module was tested as a group for example, the Book
Management Module or Reader Management Module. This ensured smooth interaction among related
functions and data structures.

4.3.3 System Testing

Finally, the system was tested as a complete application to ensure all modules worked together properly.
The system was tested with various test cases, such as issuing unavailable books or returning books not
issued, to check for error handling and data consistency.

All tests confirmed that the system performed as expected and produced accurate results.

4.3.4 Test Cases

Objective: Test for User Login

Input Expected Outcome Result

Username: user Invalid username and/or


Login Failed
Password: pass password

Username: admin
Valid username and password Login Successful
Password: admin

Table 3 Test for User Login

Objective: Test for Adding a New Book Record

Input Expected Outcome Result


Book ID: 101
Title: C Programming
Book successfully added and saved in Book record added
Basics
[Link] successfully
Author: Dennis Ritchie
Category: Programming

Table 4 Test for Adding a New Book Record

Page | 22
“Library System”

Objective: Test for Searching a Book

Input Expected Outcome Result

Search Title: C Programming Book found and details


Display details of the book
Basics displayed

Display “Book not found” Proper error message


Search Title: Python 101
message displayed

Table 5 Test for Searching a Book

Objective: Test for Issuing a Book

Input Expected Outcome Result

Book ID: 101 Book issued


Issue successful and recorded in [Link]
Reader ID: 201 successfully

Book ID: 101


Display “Book already issued” message Error handled correctly
Reader ID: 202

Table 6 Test for Issuing a Book

Objective: Test for Returning a Book

Input Expected Outcome Result

Book ID: 101


Book returned
Reader ID: Return successful; book status updated to “Available”
successfully
201
Book ID: 105
Reader ID: Display “Book not issued” message Error handled properly
202

Table 7 Test for Returning a Book

Objective: Test for Viewing All Books

Input Expected Outcome Result

Command: View All Display list of all books with details and Book list displayed
Books availability status correctly

Table 8 Test for Viewing All Books

Page | 23
“Library System”

Chapter V

5. RECOMMENDATION, FUTURE ENHANCEMENT AND


CONCLUSION
The developed Library System provides a simple, efficient, and user-friendly way to manage library
records using file handling techniques. It helps librarians easily maintain book details, reader
information, and records of issued and returned books without relying on manual registers. The system
aims to reduce workload, minimize human errors, and offer quick access to organized information.

5.1 Future Enhancement

Although the current system meets the basic requirements of a library, several improvements can be
made in future versions:

1. Integration with a Database System:


Replacing file handling with a modern database like MySQL or SQLite would allow faster
searches, secure storage, and better data management.
2. Graphical User Interface (GUI):
The console-based interface can be upgraded to a GUI using tools like C++, Java, or Python
libraries to improve user experience.
3. Barcode/QR Code Scanning:
Automating the process of book identification and issue/return using barcode or QR scanning.
4. Automatic Fine Calculation:
A system that automatically calculates overdue fines and generates reports.
5. Multi-User Login System:
Adding roles such as Admin, Librarian, and Assistant with different access levels.
6. Report Generation:
Generating monthly or yearly reports on book usage, most issued books, inactive members,
etc.

5.2 Conclusion

The Library System developed using C programming and file handling successfully fulfills the
objectives set during the project. It provides a structured and reliable way to store and manage library
records, including book entry, reader information, book issue and return operations, and category-wise
arrangements.

The system has been thoroughly tested, and most functional errors have been resolved. It is simple to
operate, lightweight, and requires minimal system resources, making it suitable for small libraries such
as those in schools or colleges.

Overall, this project demonstrates how an efficient record-keeping system can be developed using basic
C programming concepts. It serves as a strong foundation for future enhancements and can be upgraded
into a more advanced, automated, and scalable library management system.

Page | 24
“Library System”

BIBLIOGRAPHYAND REFERENCES

Books

7. Yashavant Kanetkar — Let Us C, BPB Publications


8. E. Balagurusamy — Programming in ANSI C, Tata McGraw Hill
9. Brian W. Kernighan & Dennis M. Ritchie — The C Programming Language, Prentice Hall

Websites

10. GeeksforGeeks – C Programming Language


[Link]
11. GeeksforGeeks – File Handling in C
[Link]
12. Programiz – Learn C Programming
[Link]
13. TutorialsPoint – C File I/O
[Link]
14. W3Schools – C Programming Tutorial
[Link]
15. Stack Overflow – File handling questions in C (general reference)
[Link]
16. Stack Overflow – How to read/write struct data to file in C
[Link]

Articles

17. GNU C Library Documentation – stdio.h Functions


[Link]
18. ISO C Standard Library Overview ([Link] mirror)
[Link]
19. Microsoft Documentation – C File Handling Functions
[Link]
20. Basics of Library Management System (Research Gate Article)
[Link]

Page | 25
“Library System”

USER MANUAL AND SNAPSHOTS

Figure 3 Main Menu

Figure 4 Admin Login

Page | 26
“Library System”

Figure 5 Admin Menu

Figure 6 Add Book

Page | 27
“Library System”

Figure 7 Search Book

Figure 8 Issue Book

Page | 28
“Library System”

Figure 9 List of All Books

Figure 10 Return Books

Page | 29
“Library System”

Team Contribution

Mr. Ram Shrestha


XII - K, Symbol No: 812343

Ram Shrestha was responsible for structuring the core modules and program flow of the Library System.
He coded the main framework of the program, including the login system, main menu, and the overall
modular structure. He also implemented the data structures and file handling required for storing book
and user information. Ram’s coding ensured that the system was well-organized, modular, and could
be easily extended or maintained.

Mr. Shyam Yadav


XII - K, Symbol No: 812385

Shyam Yadav focused on the user interface of the Library System. He coded the console menus,
prompts, and formatted outputs to make the system easy to read and navigate. Shyam also added input
validation and interactive messages to improve usability. His coding ensured that users could smoothly
interact with the system and understand the information displayed at every step

Miss. Sita Timilsina


XII - K, Symbol No: 812225

Sita Timilsina implemented the functional features of the system. She coded the core operations,
including adding new books, searching for books, issuing books, and updating records. She also handled
error checking and tested the modules to ensure correct functionality. Her coding contributions made
sure the Library System worked efficiently and provided a reliable experience for users.

Page | 30

You might also like