From 650c6d81c508732214e5c46343858cb0423e3ae4 Mon Sep 17 00:00:00 2001 From: Sarvjeet Singh <63469455+jeet4779@users.noreply.github.com> Date: Thu, 14 Oct 2021 21:43:14 +0530 Subject: [PATCH] Create library_management.c --- library_management.c | 100 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 library_management.c diff --git a/library_management.c b/library_management.c new file mode 100644 index 0000000..eca9004 --- /dev/null +++ b/library_management.c @@ -0,0 +1,100 @@ +/* This is a simple and very basic librray managemnet program */ + + + +#include +#include +#include +#include + +struct library +{ +char bk_name[30]; +char author[30]; +int pages; +float price; +}; + +int main() +{ +struct library l[100]; +char ar_nm[30],bk_nm[30]; +int i,j, keepcount; +i=j=keepcount = 0; + +while(j!=6) +{ +printf("\n\n1. Add book information\n2. Display book information\n"); +printf("3. List all books of given author\n"); +printf("4. List the title of specified book\n"); +printf("5. List the count of books in the library\n"); +printf("6. Exit"); + +printf ("\n\nEnter one of the above : "); +scanf("%d",&j); + +switch (j) +{ +/* Add book */ +case 1: + +printf ("Enter book name = "); +scanf ("%s",l[i].bk_name); +fflush(stdin); +printf ("Enter author name = "); +scanf ("%s",l[i].author); + +printf ("Enter pages = "); +scanf ("%d",&l[i].pages); + +printf ("Enter price = "); +scanf ("%f",&l[i].price); +keepcount++; + +break; +case 2: +printf("you have entered the following information\n"); +for(i=0; i