C Programming Create a system managing a mini library syste

// C Programming

Create a system managing a mini library system. Every book corresponds to a record (line) in a text file named \"mylibrary.txt\". Each record consists of 6 fields (Book ID, Title, Author, Possession, Checked out Date, Due Date) separated by comma: 1, Book1, Author1, Library, null, null 2, Book1, Authorl, User1, 2014-10-22, 2014-11-21 3, Book2, Author2, User1, 2014-10-23, 2014-11-22 4, Book3, Author2, User2, 2014-10-23, 2014-11-22 5, Book4, Atuhor3, User2, 2014-09-22, 2014-10-22 No comma \", \"in title or author name. This mini library keeps the record for each book in the library. Different books can share the book \"Title\". But the \"Book ID\" for each book is unique. One author may have multiple books. Eg. Both book2 and book3 are written by author1 Possession field is \"Library\" means this book is kept in library, such as book #001. Otherwise, this book is checked out by the corresponding user. E.g. book #3 is checked out by User1. A user is allowed to check out up to 3 books. The \"Checked out Date\" field specifies the time of the latest checked out date. The loan period for each book is 30 days. \"The Due Data\" filed specifies the time the book should be returned. This system should provide a menu with following functionalities that the bookkeeper can choose from at the top-level menu: Enter \"d\" to delete a book from library Ask for book ID. Examine if this book exists. If no, print a message \"No such book!\" and then go to 4). Otherwise, 3) Remove the book with the given book ID from the library (seed) and then go to 4). Provide options \"t\" for \"\" or \"b\" for \"Back to main menu\". (If \"\", go to step 1))

Solution

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct library
{
char bk_name[30];
char author[30];
int pages;
float price;
};

int main()
{
struct library l[3];
char ar_nm,bk_nm;
int i,j;

printf (\"1. Add book information\ 2. Display book information\ 3. List all books of given author\ 4. List the title of specified book\ 5. List the count of books in the library\ 6. Exit\");

printf (\"\ \ Enter one of the above : \");
scanf(\"%d\",&j);

switch (j)
{
case 1:
for (i=0;i<3;i++)
{

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

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);
}
break;
case 2:
printf(\"you have entered the following information\ \");
for(i=0;i<3;i++)
{
printf (\"book name = %s\",l[i].bk_name);

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

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

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

case 3:
printf (\"Enter author name : \");
scanf (\"%s\",&ar_nm);
for (i=0;i<3;i++)
{
if (ar_nm == l[i].author)
printf (\"%s %s %d %f\",l[i].bk_name,l[i].author,l[i].pages,l[i].price);
}
break;

case 4:
printf (\"Enter book name : \");
scanf (\"%s\",&bk_nm);
for (i=0;i<3;i++)
{
if (bk_nm == l[i].bk_name)
printf (\"%s %s %d %f\",l[i].bk_name,l[i].author,l[i].pages,l[i].price);
}
break;

case 5:
for (i=0;i<3;i++)
{

}
break;
case 6:
exit (0);


}
return 0;
}

// C Programming Create a system managing a mini library system. Every book corresponds to a record (line) in a text file named \
// C Programming Create a system managing a mini library system. Every book corresponds to a record (line) in a text file named \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site