You are on page 1of 12

INDEX FOR MICROPROJECT

Sr.No Chapter No Page No

01 ACKNOWLEDGEMENT 1

02 ABSTRACT 2

03 CHAPTER NO 1 INTRODUCTION 3

04 CHAPTER NO 2 ALGORITHM 4

05 CHAPTER NO 3 FLOWCHART 5

06 CHAPTER NO 4 PROGRAM CODE 7

07 CONCLUSION 8

08 REFERENCES 9
ACKNOWLEDGEMENT

We would like to express my sincere gratitude to Mrs. M . R Patil mam, my subject teacher, for
their invaluable guidance, support, and encouragement throughout the completion of this C
programming micro project. Their expertise and insights have been instrumental in shaping the
direction and quality of this project. I would also like to extend my appreciation to my faculty,
for providing the necessary resources and environment conducive to learning and innovation.
Furthermore, I am thankful to my family and friends for their unwavering encouragement and

understanding during the challenging phases of this project.


ABSTRACT

This C program creates a simple library management system using structures. It allows users to
add book details, display the list of books and their details, display the total number of books in
the library, and exit the program. The program utilizes a menu-driven approach with a while loop
and switch-case statements. Users can input book details such as name, author, number of pages,
and cost, and the program stores them in an array of structures. The program abstracts the
functionality of managing a library's book collection efficiently.
In this C program, the switch statement is used to provide a menu-driven interface for managing
a library system.
CHAPTER NO 1
INTRODUCTION

This C program serves as a simple library management system, allowing users to add book
details, display the list of books and their details, and view the total number of books in the
library. It's designed to provide basic functionality for managing a library's book collection
efficiently. The program utilizes structures to organize and store book information and
implements a menu-driven interface for user interaction. This micro project aims to demonstrate
basic concepts of data organization and user interaction in C programming.
CHAPTER NO 2
ALGORITHM

Step 1: Start
Step 2: Declare a structure library with attributes book_name, author_name, cost, and
no_of_pages.
Step 3 : Declare variables lib as an array of library, book_name to temporarily store book names,
and i, j, and count as counters.
Step 4 : Initialize i, j, and count to 0.
Step 5 : Start a while loop that continues until j is not equal to 6.
Step 6 : Display a menu with options:
- 1: Add Book details
- 2: Display the list of books and their details
- 3: Display the total number of books in the library
- 4: Exit
Step 7 : Prompt the user to enter a number corresponding to their choice and store it in j.
Step 8 : Use a switch statement to perform actions based on the user's choice:
- Case 1: Prompt the user to enter book details and store them in the lib array.
- Case 2: Display the list of books and their details from the lib array if there are any.
- Case 3: Display the total number of books stored in the lib array.
- Case 4: Exit the program.
- Default: Display a message for invalid input.
Step 9 : End of the switch statement.
Step 10: End of the while loop.
Step 11 : End of the program.
CHAPTER NO 3
FLOWCHART
CHAPTER NO 4
PROGRAM CODE

#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 ");
}

}
OUTPUT
CONCLUSION

In conclusion, this program provides a basic interface for managing a library system. Users can
add book details including the book name, author name, number of pages, and cost. They can
also display the list of books and their details, as well as view the total number of books stored in
the library. The program ensures ease of use with a menu-driven approach. However, it is a
simple prototype and can be further enhanced with features like book deletion, searching, and
sorting. Overall, it serves as a starting point for developing a more comprehensive library
management system."
REFERENCES
1.https://www.geeksforgeeks.org/making-menu-driven-program-using-switch-case/
2.https://www.tutorialspoint.com/cprogramming/c_input_output.htM
3.https://www.programiz.com/c-programming/c-structures

You might also like