E -Library Management System Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss the approach to creating an E-Library Management System where the user has the following options: Add book information.Display book information.To list all books of a given author.To list the count of books in the library. E -Library Management System Functionalities Required:If the user tries to add a book then the user must have to provide the below specific Information about the book:Enter Book Name:Enter Author Name:Enter Pages:Enter Price:When the user tries to display all books of a particular author then the user must have to enter the name of the author:Enter the author's name:The E-Library Management System must be also capable of counting all the books available in the library.Note: Follow given link to build a Web application on Library Management System. Below is the program to implement the E-Library Management System: C++ // C++ code addition #include <iostream> #include <string> using namespace std; // Create Structure of Library struct library { string book_name; string author; int pages; float price; }; // Driver Code int main() { // Create an array of structs library lib[100]; string ar_nm, bk_nm; // Keep the track of the number of // of books available in the library int i, input, count; i = input = count = 0; // Iterate the loop while (input != 5) { cout << "\n\n********######" << "WELCOME TO E-LIBRARY " << "#####********\n"; cout << "\n\n1. Add book information\n2. Display book information\n"; cout << "3. List all books of given author\n"; cout << "4. List the count of books in the library\n"; cout << "5. Exit\n"; // Enter the book details cout << "\n\nEnter one of the above: "; cin >> input; // Process the input switch (input) { // Add book case 1: cout << "Enter book name = "; cin >> lib[i].book_name; cout << "Enter author name = "; cin >> lib[i].author; cout << "Enter pages = "; cin >> lib[i].pages; cout << "Enter price = "; cin >> lib[i].price; count++; break; // Print book information case 2: cout << "you have entered the following information\n"; for (i = 0; i < count; i++) { cout << "book name = " << lib[i].book_name; cout << "\t author name = " << lib[i].author; cout << "\t pages = " << lib[i].pages; cout << "\t price = " << lib[i].price << endl; } break; // Take the author name as input case 3: cout << "Enter author name : "; cin >> ar_nm; for (i = 0; i < count; i++) { if (ar_nm == lib[i].author) cout << lib[i].book_name << " " << lib[i].author << " " << lib[i].pages << " " << lib[i].price << endl; } break; // Print total count case 4: cout << "\n No of books in library : " << count << endl; break; case 5: exit(0); } } return 0; } // The code is contributed by Nidhi goel. C // C program for the E-library // Management System #include <stdio.h> #include <stdlib.h> #include <string.h> // Create Structure of Library struct library { char book_name[20]; char author[20]; int pages; float price; }; // Driver Code int main() { // Create a instance struct library lib[100]; char ar_nm[30], bk_nm[30]; // Keep the track of the number of // of books available in the library int i, input, count; i = input = count = 0; // Iterate the loop while (input != 5) { printf("\n\n********######" "WELCOME TO E-LIBRARY " "#####********\n"); printf("\n\n1. Add book infor" "mation\n2. Display " "book information\n"); printf("3. List all books of " "given author\n"); printf( "4. List the count of book" "s in the library\n"); printf("5. Exit"); // Enter the book details printf("\n\nEnter one of " "the above: "); scanf("%d", &input); // Process the input switch (input) { // Add book case 1: printf("Enter book name = "); scanf("%s", lib[i].book_name); printf("Enter author name = "); scanf("%s", lib[i].author); printf("Enter pages = "); scanf("%d", &lib[i].pages); printf("Enter price = "); scanf("%f", &lib[i].price); count++; break; // Print book information case 2: printf("you have entered" " the following " "information\n"); for (i = 0; i < count; i++) { printf("book name = %s", lib[i].book_name); printf("\t author name = %s", lib[i].author); printf("\t pages = %d", lib[i].pages); printf("\t price = %f", lib[i].price); } break; // Take the author name as input case 3: printf("Enter author name : "); scanf("%s", ar_nm); for (i = 0; i < count; i++) { if (strcmp(ar_nm, lib[i].author) == 0) printf("%s %s %d %f", lib[i].book_name, lib[i].author, lib[i].pages, lib[i].price); } break; // Print total count case 4: printf("\n No of books in " "brary : %d", count); break; case 5: exit(0); } } return 0; } Java import java.util.Scanner; // Create a class for the Library class Library { String bookName; String author; int pages; float price; } // Main class for the driver code public class ELibrary { public static void main(String[] args) { // Create an array of Library objects Library[] library = new Library[100]; String arNm; // Keep track of the number of books available in the library int i, input, count; i = input = count = 0; // Initialize the array with Library objects for (int j = 0; j < library.length; j++) { library[j] = new Library(); } // Scanner to take input from the user Scanner scanner = new Scanner(System.in); // Iterate the loop while (input != 5) { System.out.println("\n\n********###### WELCOME TO E-LIBRARY #####********"); System.out.println("1. Add book information\n2. Display book information"); System.out.println("3. List all books of given author\n4. List the count of books in the library"); System.out.println("5. Exit"); // Enter the book details System.out.print("\n\nEnter one of the above: "); input = scanner.nextInt(); // Process the input switch (input) { // Add book case 1: System.out.print("Enter book name = "); library[i].bookName = scanner.next(); System.out.print("Enter author name = "); library[i].author = scanner.next(); System.out.print("Enter pages = "); library[i].pages = scanner.nextInt(); System.out.print("Enter price = "); library[i].price = scanner.nextFloat(); count++; i++; break; // Print book information case 2: System.out.println("You have entered the following information"); for (int j = 0; j < count; j++) { System.out.println("Book name = " + library[j].bookName + "\t Author name = " + library[j].author + "\t Pages = " + library[j].pages + "\t Price = " + library[j].price); } break; // Take the author name as input case 3: System.out.print("Enter author name: "); arNm = scanner.next(); for (int j = 0; j < count; j++) { if (arNm.equals(library[j].author)) { System.out.println(library[j].bookName + " " + library[j].author + " " + library[j].pages + " " + library[j].price); } } break; // Print total count case 4: System.out.println("\nNo of books in library: " + count); break; case 5: System.exit(0); } } } } Python3 # Python code equivalent of the C++ code class Library: def __init__(self, book_name, author, pages, price): self.book_name = book_name self.author = author self.pages = pages self.price = price def __str__(self): return f"{self.book_name}\t {self.author}\t {self.pages}\t {self.price}" # Driver Code if __name__ == "__main__": # Create an array of Library objects lib = [] # Keep the track of the number of # of books available in the library count = 0 # Iterate the loop while True: print("\n\n********######WELCOME TO E-LIBRARY #####********\n") print("1. Add book information\n2. Display book information\n", "3. List all books of given author\n4. List the count of books in the library\n5. Exit\n") # Enter the book details input_choice = input("Enter one of the above: ") # Process the input if input_choice == '1': book_name = input("Enter book name = ") author = input("Enter author name = ") pages = int(input("Enter pages = ")) price = float(input("Enter price = ")) lib.append(Library(book_name, author, pages, price)) count += 1 elif input_choice == '2': print("you have entered the following information") for book in lib: print(book) elif input_choice == '3': ar_nm = input("Enter author name : ") for book in lib: if book.author == ar_nm: print(book) elif input_choice == '4': print(f"\nNo of books in library : {count}\n") elif input_choice == '5': exit(0) C# using System; // Create Structure of Library struct Library { public string BookName; public string Author; public int Pages; public float Price; } // Driver Code class Program { static void Main() { // Create an array of structs Library[] library = new Library[100]; string authorName; // Keep track of the number of books available in the library int i, input, count; i = input = count = 0; // Iterate the loop while (input != 5) { Console.WriteLine("\n\n********######" + "WELCOME TO E-LIBRARY " + "#####********\n"); Console.WriteLine("\n\n1. Add book information\n2. Display book information\n" + "3. List all books of given author\n" + "4. List the count of books in the library\n" + "5. Exit\n"); // Enter the book details Console.Write("\n\nEnter one of the above: "); input = int.Parse(Console.ReadLine()); // Process the input switch (input) { // Add book case 1: Console.Write("Enter book name = "); library[i].BookName = Console.ReadLine(); Console.Write("Enter author name = "); library[i].Author = Console.ReadLine(); Console.Write("Enter pages = "); library[i].Pages = int.Parse(Console.ReadLine()); Console.Write("Enter price = "); library[i].Price = float.Parse(Console.ReadLine()); count++; break; // Print book information case 2: Console.WriteLine("You have entered the following information"); for (i = 0; i < count; i++) { Console.WriteLine($"Book name = {library[i].BookName}" + $"\t Author name = {library[i].Author}" + $"\t Pages = {library[i].Pages}" + $"\t Price = {library[i].Price}"); } break; // Take the author name as input case 3: Console.Write("Enter author name : "); authorName = Console.ReadLine(); for (i = 0; i < count; i++) { if (authorName == library[i].Author) Console.WriteLine($"{library[i].BookName} {library[i].Author} {library[i].Pages} {library[i].Price}"); } break; // Print total count case 4: Console.WriteLine($"\nNo of books in library: {count}\n"); break; case 5: Environment.Exit(0); break; } } } } JavaScript const readline = require('readline'); // Create a class for the Library class Library { constructor() { this.bookName = ""; this.author = ""; this.pages = 0; this.price = 0.0; } } // Main function for the driver code function main() { // Create an array of Library objects let library = new Array(100).fill(null).map(() => new Library()); let arNm; // Keep track of the number of books available in the library let i = 0, input = 0, count = 0; // Initialize the array with Library objects // Iterate the loop const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.setPrompt("\n\nEnter one of the above: "); rl.prompt(); // Enter the book details rl.on('line', (line) => { input = parseInt(line.trim()); // Process the input switch (input) { // Add book case 1: rl.question("Enter book name = ", (bookName) => { library[i].bookName = bookName; rl.question("Enter author name = ", (author) => { library[i].author = author; rl.question("Enter pages = ", (pages) => { library[i].pages = parseInt(pages); rl.question("Enter price = ", (price) => { library[i].price = parseFloat(price); count++; i++; rl.prompt(); }); }); }); }); break; // Print book information case 2: console.log("You have entered the following information"); for (let j = 0; j < count; j++) { console.log("Book name = " + library[j].bookName + "\t Author name = " + library[j].author + "\t Pages = " + library[j].pages + "\t Price = " + library[j].price); } rl.prompt(); break; // Take the author name as input case 3: rl.question("Enter author name: ", (author) => { arNm = author; for (let j = 0; j < count; j++) { if (arNm === library[j].author) { console.log(library[j].bookName + " " + library[j].author + " " + library[j].pages + " " + library[j].price); } } rl.prompt(); }); break; // Print total count case 4: console.log("\nNo of books in library: " + count); rl.prompt(); break; case 5: rl.close(); break; default: rl.prompt(); } }).on('close', () => { process.exit(0); }); } // Call the main function to start the program main(); Output:Displaying the functionalities and input for option 1: For Choice 2 and 3: For choice 4 and 5: Please refer to the complete article of Library Management System Project. Comment More infoAdvertise with us Next Article Asymptotic Notations for Analysis of Algorithms J jagroopofficial Follow Improve Article Tags : Tree Project Technical Scripter Recursion C Programs DSA Software Development Technical Scripter 2020 Binary Tree Library Management System +6 More Practice Tags : RecursionTree Similar Reads Basics & PrerequisitesTime and Space ComplexityMany times there are more than one ways to solve a problem with different algorithms and we need a way to compare multiple ways. Also, there are situations where we would like to know how much time and resources an algorithm might take when implemented. To measure performance of algorithms, we typic 13 min read Asymptotic Notations for Analysis of AlgorithmsWe have discussed Asymptotic Analysis, and Worst, Average, and Best Cases of Algorithms. The main idea of asymptotic analysis is to have a measure of the efficiency of algorithms that don't depend on machine-specific constants and don't require algorithms to be implemented and time taken by programs 8 min read Data StructuresArray Data Structure GuideIn this article, we introduce array, implementation in different popular languages, its basic operations and commonly seen problems / interview questions. An array stores items (in case of C/C++ and Java Primitive Arrays) or their references (in case of Python, JS, Java Non-Primitive) at contiguous 3 min read String in Data StructureA string is a sequence of characters. The following facts make string an interesting data structure.Small set of elements. Unlike normal array, strings typically have smaller set of items. For example, lowercase English alphabet has only 26 characters. ASCII has only 256 characters.Strings are immut 2 min read Hashing in Data StructureHashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access. Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function. It enables fast retrieval of information based on its key. The 2 min read Linked List Data StructureA linked list is a fundamental data structure in computer science. It mainly allows efficient insertion and deletion operations compared to arrays. Like arrays, it is also used to implement other data structures like stack, queue and deque. Hereâs the comparison of Linked List vs Arrays Linked List: 2 min read Stack Data StructureA Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first 2 min read Queue Data StructureA Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of "First in, First out" (FIFO), where the first element added to the queue is the first one to be removed. It is used as a buffer in computer systems 2 min read Tree Data StructureTree Data Structure is a non-linear data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes. Types of TreeBinary Tree : Every node has at most two childrenTernary Tree : Every node has at most 4 min read Graph Data StructureGraph Data Structure is a collection of nodes connected by edges. It's used to represent relationships between different entities. If you are looking for topic-wise list of problems on different topics like DFS, BFS, Topological Sort, Shortest Path, etc., please refer to Graph Algorithms. Basics of 3 min read Trie Data StructureThe Trie data structure is a tree-like structure used for storing a dynamic set of strings. It allows for efficient retrieval and storage of keys, making it highly effective in handling large datasets. Trie supports operations such as insertion, search, deletion of keys, and prefix searches. In this 15+ min read AlgorithmsSearching AlgorithmsSearching algorithms are essential tools in computer science used to locate specific items within a collection of data. In this tutorial, we are mainly going to focus upon searching in an array. When we search an item in an array, there are two most common algorithms used based on the type of input 2 min read Sorting AlgorithmsA Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order. There exist different sorting algorithms for differ 3 min read Introduction to RecursionThe process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. A recursive algorithm takes one step toward solution and then recursively call itself to further move. The algorithm stops once we reach the solution 14 min read Greedy AlgorithmsGreedy algorithms are a class of algorithms that make locally optimal choices at each step with the hope of finding a global optimum solution. At every step of the algorithm, we make a choice that looks the best at the moment. To make the choice, we sometimes sort the array so that we can always get 3 min read Graph AlgorithmsGraph is a non-linear data structure like tree data structure. The limitation of tree is, it can only represent hierarchical data. For situations where nodes or vertices are randomly connected with each other other, we use Graph. Example situations where we use graph data structure are, a social net 3 min read Dynamic Programming or DPDynamic Programming is an algorithmic technique with the following properties.It is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for the same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of 3 min read Bitwise AlgorithmsBitwise algorithms in Data Structures and Algorithms (DSA) involve manipulating individual bits of binary representations of numbers to perform operations efficiently. These algorithms utilize bitwise operators like AND, OR, XOR, NOT, Left Shift, and Right Shift.BasicsIntroduction to Bitwise Algorit 4 min read AdvancedSegment TreeSegment Tree is a data structure that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array. The tree 3 min read Pattern SearchingPattern searching algorithms are essential tools in computer science and data processing. These algorithms are designed to efficiently find a particular pattern within a larger set of data. Patten SearchingImportant Pattern Searching Algorithms:Naive String Matching : A Simple Algorithm that works i 2 min read GeometryGeometry is a branch of mathematics that studies the properties, measurements, and relationships of points, lines, angles, surfaces, and solids. From basic lines and angles to complex structures, it helps us understand the world around us.Geometry for Students and BeginnersThis section covers key br 2 min read Interview PreparationInterview Corner: All Resources To Crack Any Tech InterviewThis article serves as your one-stop guide to interview preparation, designed to help you succeed across different experience levels and company expectations. Here is what you should expect in a Tech Interview, please remember the following points:Tech Interview Preparation does not have any fixed s 3 min read GfG160 - 160 Days of Problem SolvingAre you preparing for technical interviews and would like to be well-structured to improve your problem-solving skills? Well, we have good news for you! GeeksforGeeks proudly presents GfG160, a 160-day coding challenge starting on 15th November 2024. In this event, we will provide daily coding probl 3 min read Practice ProblemGeeksforGeeks Practice - Leading Online Coding PlatformGeeksforGeeks Practice is an online coding platform designed to help developers and students practice coding online and sharpen their programming skills with the following features. GfG 160: This consists of most popular interview problems organized topic wise and difficulty with with well written e 6 min read Problem of The Day - Develop the Habit of CodingDo you find it difficult to develop a habit of Coding? If yes, then we have a most effective solution for you - all you geeks need to do is solve one programming problem each day without any break, and BOOM, the results will surprise you! Let us tell you how:Suppose you commit to improve yourself an 5 min read Like