Get the FREE certificate on C, C++, Java, Python, Perl, PHP, SQL, Linux & Javascript!
Home C C++ Java Python Perl PHP Spring SQL Javascript Linux

C project on Library Management

You are here : Home » C projects » Project on Library Manageent

Program: Library Management
Author: CppBuzz
Date: 17th Nov 2017


struct library
char bk_name[30];
char arthur[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;

printf("\n\n1. Add book information\n2. Display book information\n");
printf("\n\n3. List all books of given author\n");
printf("\n\n4. List the title of specified book\n");
printf("\n\n5. List the count of books in the library\n");
printf("\n\n6. Exit");

printf ("\n\nEnter one of the above : ");

switch (j)
/* Add book */
case 1:  

printf ("Enter book name = ");
scanf ("%s",l[i].bk_name);

printf ("Enter arthur name = ");
scanf ("%s",l[i].arthur);

printf ("Enter pages = ");
scanf ("%d",&l[i].pages);

printf ("Enter price = ");
scanf ("%f",&l[i].price);

case 2:
printf("you have entered the following information\n");
for(i=0; i<keepcount; i++)
printf ("book name = %s",l[i].bk_name);

printf ("\t author name = %s",l[i].arthur);

printf ("\t  pages = %d",l[i].pages);

printf ("\t  price = %f",l[i].price);

case 3:
printf ("Enter arthur name : ");
scanf ("%s",ar_nm);
for (i=0; i<keepcount; i++)
if (strcmp(ar_nm, l[i].arthur) == 0)
printf ("%s %s %d %f",l[i].bk_name,l[i].arthur,l[i].pages,l[i].price);

case 4:
printf ("Enter book name : ");
scanf ("%s",bk_nm);
for (i=0; i<keepcount; i++)
if (strcmp(bk_nm, l[i].bk_name) == 0)
printf ("%s \t %s \t %d \t %f",l[i].bk_name,l[i].arthur,l[i].pages,l[i].price);

case 5:
printf("\n No of books in library : %d", keepcount);
case 6:
exit (0); 

return 0;