0% found this document useful (0 votes)
10 views13 pages

pic micro project1

The document outlines a micro project report on a Library Management System developed in C by student Arekar Amol Balu for the course Programming in C. It details the project's purpose, which is to securely store and manage book details, and includes a structured C program that allows users to add, display, and count books. The report is submitted under the guidance of Prof. Hole P.P. at S.S.M. Adsul Polytechnic College for the academic year 2023-24.

Uploaded by

kartikgagare099
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)
10 views13 pages

pic micro project1

The document outlines a micro project report on a Library Management System developed in C by student Arekar Amol Balu for the course Programming in C. It details the project's purpose, which is to securely store and manage book details, and includes a structured C program that allows users to add, display, and count books. The report is submitted under the guidance of Prof. Hole P.P. at S.S.M. Adsul Polytechnic College for the academic year 2023-24.

Uploaded by

kartikgagare099
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
You are on page 1/ 13

Program & Program code : CO-2-K

Course : Pograming in C (PIC)


Course code : 312303

Submitted by
Name of sudant Enrollment No Program
Arekar Amol Balu 24611980194 CO-2-K

Under the Guidance of PROF.


Hole P.P.
In partial fulfillment of requirement for the award of Diploma
In computer engineering.
MSBTE, Mumbai.

Academic Year: 2023-24


S.S.M. ADSUL POLYTECHNIC COLLEGE, CHAS,
Ahilyadevi Nagar-414 005(M.S)
S.S.M. ADSUL POLYTECHNIC COLLEGE, CHAS,
Ahilyadevi Nagar-414 005(M.S)

CERTIFICATE
This is to certify that the micro project report entitled

Library ManageMent SySteM in C


Submitted by
Name of sudant Enrollment No Program
1. Arekar Amol Balu 24611980194 CO-2-K
Of semester IV institute, Sau. Sundarabai Manik Adsul Polytechnic, Chas, Ahilyadevi Nagar (code: 1464)
has completed the micro project satisfactorily in course Software Testing (22619) for the Academic year 2023-
24 as prescribed in the MSBTE curriculum.

Place: Chas Ahilyadevi Nagar


Date: ………………………….

Prof. Hole P.P Prof.Hole.P.P. Prof.Gadakh.R.S.


(Micro Project guide) (Head of Dept.) (Principal)
Library ManageMent SySteM in C

In this article, you will learn about the Library Management System in C. This
is a project demonstrating the storage of data related to books. You will also learn
its usage and applications in detail.

What is Library Management System, and why should we use it?


The concept of storing or recording the details of books embedded within the user's system is known as
Library Management System. It details the type of books, the list of books, etc. Only a person with the login
credentials can access the Library Management System. That person can perform many operations like
adding the book details, removing the book details, displaying the book details, modifying the book details,
etc.

We must use the Library Management System in order to have secured storage of book details contained
within the Library ( probably ). This feature is generally enabled in order to protect the data, which is highly
confidential. This is one of the simplest Management systems built within the system using the C
programming language.

The Library Management System overviews the concept of storing and generating all the data or records of
the book contained within the library. This can be known as a general database which stores the data of the
book details. It helps in searching the details by reducing time consumption. Not only protects the details of
the books in the library but also saves all the data up to date without missing any. This is the major benefit
of the Library Management System

Let us construct a C program to perform the operations such as "


Adding the book details ", " Displaying the book details ", and " Finding the total
number of books in the library "

As we have classified the entire program into 5 blocks, let us discuss each block one by one.
Block 1:
// to import standard input and output
#include <stdio.h>
// to import clear statements, etc. ( if any )
#include <conio.h>
// to import standard libraries
#include <stdlib.h>
// to import strings and use strings
#include <string.h>

In this block, we have included or imported all the pre-processors that are
necessary for the program, which tells the C compiler to perform specific
operations before compiling accordingly. This step, i.e., " Pre-processors ", is one
of the main steps in the " Structure of C program ". Without using specific pre-
processors, we cannot perform any required task within the program.

Block 2:
// declare all variables which store their respective
// data using structure ' library ' struct
library
{
// to store the name of the book char
book_name[100];
// to store the name of the author of the book
char author_name[100]; // to store the cost of the
book float cost;
// to store the number of pages of the book int
no_of_pages;
};

This block deals with the structure " library ", which involves the mandatory
variables. Generally, the Structures in C language are used to group several
variables within a single place. These variables are declared and initiated within
this block in order to use those whenever needed throughout the program. In the
same way, the structure " library " is also used in this program. It is used in order
to declare the variables like " book_name ", " author_name ", " cost ", and "
no_of_pages ", which possess di erent data types.

Block 3:
// main function int
main()
{
// using the strut library again.' //
in order to perform operations
struct library lib[100]; char
book_name[100];
int i, j, count;
i = 0; j = 0;
count = 0;

// block 3.1

while(j!=6)
{
// statements regarding the choice

// block 3.1.1

switch(j)
{
// switch cases depending on the option chosen
}
}

In this block, the main section is initiated. We have considered " int main "
directly. In the main section, we reconsidered the structure " library " that has been
declared previously in order to access its members. The name of the book using a
variable " book_name " can be declared again to have a specific nature and
difference between the one declared in the structure, and the other declared in the
main section.

The variables like " book_name ", " i ", " j " and " count " are declared in which the
variable " book_name " defines the name of the book entered, " i " and " j " defines
the use for iteration, and " count " defines the number of books present in the
library. After declaring the required variables according to their data types, we
considered a while loop and a switch case. Let us discuss everything about while
loop and switch cases in the upcoming statements.
Block 3.1.1:
switch(j)
{
// in order to add the book details
case 1:
printf(" \nYou can add the details of the book ");
printf(" \nEnter the book name: "); scanf(" %s",
lib[i].book_name); printf(" \nEnter the author
name: "); scanf(" %s", lib[i].author_name);
printf(" \nEnter the number of pages: "); scanf("
%d", &lib[i].no_of_pages); printf(" \nEnter the
cost of the book: "); scanf(" %f", &lib[i].cost);
count = count + 1; i = i + 1; break;
case
2:
// if there are no books registered previously
if (count==0)
{
printf(" \nThere are no books stored!!\n\n ");
}
else
{
// to view the list of the books
printf(" \nYou can view the list of books ");
printf(" \nThe list of books are: "); for(i=0; i
< count; i++)
{
printf(" \nThe name of the book is: %s ", lib[i].book_name);
printf(" \nThe name of the author is: %s ", lib[i].author_name); printf("
\nThe number of pages are: %d ", lib[i].no_of_pages); printf(" \nThe
cost of the book is: %f\n\n ", lib[i].cost);
}
}
break;
case
3:
// to view the total number of books printf(" \nTotal number of
books in the library are: %d\n\n ", count); break;

case 4:
// to exit from the program
exit(0);

default:
// if any number other than 1, 2, 3, 4 is entered
printf(" \nInvalid number entered\n\n ");
}

In this block of code, every case is considered, and its corresponding output is
given accordingly. For example, if the number entered is 2 out of 1, 2, 3, 4, the
output of the list of books will be given as the serial number 2 denotes the "
display the list of books in the library " statement. In the same way, when the
input number is given as 1, it takes the information of the new book as the serial
number 1 denotes " Add book details ". When a default number, i.e., a number
which is not 1, 2, 3, or 4, is entered, it returns the default case and then prints "
Invalid number entered " as there is no statement confession to the respective
numbers other than 1, 2, 3, and 4.
// block 1
// to import standard input and output
#include <stdio.h>
// to import clear statements, etc. ( if any )
#include <conio.h>
// to import standard libraries
#include <stdlib.h>
// to import strings and use strings
#include <string.h>

// block 2

// declare all variables which store their respective


// data using structure ' library ' struct
library
{
// to store the name of the book char
book_name[100];
// to store the name of the author of the book
char author_name[100]; // to store the cost of the
book float cost;
// to store the number of pages of the book int
no_of_pages;
};

// block 3

// main function int


main()
{
// using the strut library again.'
// in order to perform operations
struct library lib[100];
char book_name[100];
int i, j, count;
i = 0; j = 0;
count = 0;

// block 3.1

while(j!=6)
{
printf(" \n\n1. Add Book details\n "); printf(" 2. Display
the list of books and its details\n "); printf(" 3. Display the
total no. of books in the library\n "); printf(" 4. Exit\n\n");
printf(" Enter the number: "); scanf(" %d", &j);

// block 3.1.1

switch(j)
{
// in order to add the book details
case 1:
printf(" \nYou can add the details of the book ");
printf(" \nEnter the book name: "); scanf(" %s",
lib[i].book_name); printf(" \nEnter the author
name: "); scanf(" %s", lib[i].author_name);
printf(" \nEnter the number of pages: "); scanf("
%d", &lib[i].no_of_pages); printf(" \nEnter the
cost of the book: "); scanf(" %f", &lib[i].cost);
count = count + 1; i = i + 1; break;

case 2:
// if there are no books registered previously
if (count==0)
{
printf(" \nThere are no books stored!!\n\n ");
}
else
{
// to view the list of the books
printf(" \nYou can view the list of books ");
printf(" \nThe list of books are: "); for(i=0; i
< count; i++)
{
printf(" \nThe name of the book is: %s ", lib[i].book_name);
printf(" \nThe name of the author is: %s ", lib[i].author_name); printf("
\nThe number of pages are: %d ", lib[i].no_of_pages); printf(" \nThe
cost of the book is: %f\n\n ", lib[i].cost);
}
}
break;
case
3:
// to view the total number of books printf(" \nTotal number of
books in the library are: %d\n\n ", count); break;

case 4:
// to exit from the program
exit(0); default:
// if any number other than 1, 2, 3, 4 is entered
printf(" \nInvalid number entered\n\n ");
}

You might also like