├── .gitignore ├── README.md └── library management system code /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # librarymanagementsystem 2 | In this article, we will discuss the approach to create an E-Library Management System where the user has the following options: 3 | 4 | 1. Add book information. 5 | 2. Display book information. 6 | 3. To list all books of a given author. 7 | 4. To list the count of books in the library. 8 | Functionalities Required: 9 | 10 | If the user tries to add a book then the user must have to provide the below specific Information about the book as: 11 | 1. Enter Book Name: 12 | 2. Enter Author Name: 13 | 3. Enter Pages: 14 | 4. Enter Price: 15 | When the user tries to display all books of a particular author then the user must have to enter the name of the author: 16 | 1. Enter the author name: 17 | The E-Library management System must be also capable of counting all the books available in the library. 18 | Below is the program to implement the E-Library Management System 19 | -------------------------------------------------------------------------------- /library management system code: -------------------------------------------------------------------------------- 1 | // C program for the E-library 2 | // Management System 3 | #include 4 | #include 5 | #include 6 | 7 | // Create Structure of Library 8 | struct library { 9 | char book_name[20]; 10 | char author[20]; 11 | int pages; 12 | float price; 13 | }; 14 | 15 | // Driver Code 16 | int main() 17 | { 18 | // Create a instance 19 | struct library lib[100]; 20 | 21 | char ar_nm[30], bk_nm[30]; 22 | 23 | // Keep the track of the number of 24 | // of books available in the library 25 | int i, input, count; 26 | 27 | i = input = count = 0; 28 | 29 | // Iterate the loop 30 | while (input != 5) { 31 | 32 | printf("\n\n********######" 33 | "WELCOME TO E-LIBRARY " 34 | "#####********\n"); 35 | printf("\n\n1. Add book infor" 36 | "mation\n2. Display " 37 | "book information\n"); 38 | printf("3. List all books of " 39 | "given author\n"); 40 | printf( 41 | "4. List the count of book" 42 | "s in the library\n"); 43 | printf("5. Exit"); 44 | 45 | // Enter the book details 46 | printf("\n\nEnter one of " 47 | "the above: "); 48 | scanf("%d", &input); 49 | 50 | // Process the input 51 | switch (input) { 52 | 53 | // Add book 54 | case 1: 55 | 56 | printf("Enter book name = "); 57 | scanf("%s", lib[i].book_name); 58 | 59 | printf("Enter author name = "); 60 | scanf("%s", lib[i].author); 61 | 62 | printf("Enter pages = "); 63 | scanf("%d", &lib[i].pages); 64 | 65 | printf("Enter price = "); 66 | scanf("%f", &lib[i].price); 67 | count++; 68 | 69 | break; 70 | 71 | // Print book information 72 | case 2: 73 | printf("you have entered" 74 | " the following " 75 | "information\n"); 76 | for (i = 0; i < count; i++) { 77 | 78 | printf("book name = %s", 79 | lib[i].book_name); 80 | 81 | printf("\t author name = %s", 82 | lib[i].author); 83 | 84 | printf("\t pages = %d", 85 | lib[i].pages); 86 | 87 | printf("\t price = %f", 88 | lib[i].price); 89 | } 90 | break; 91 | 92 | // Take the author name as input 93 | case 3: 94 | printf("Enter author name : "); 95 | scanf("%s", ar_nm); 96 | for (i = 0; i < count; i++) { 97 | 98 | if (strcmp(ar_nm, 99 | lib[i].author) 100 | == 0) 101 | printf("%s %s %d %f", 102 | lib[i].book_name, 103 | lib[i].author, 104 | lib[i].pages, 105 | lib[i].price); 106 | } 107 | break; 108 | 109 | // Print total count 110 | case 4: 111 | printf("\n No of books in " 112 | "brary : %d", 113 | count); 114 | break; 115 | case 5: 116 | exit(0); 117 | } 118 | } 119 | return 0; 120 | } 121 | --------------------------------------------------------------------------------