Skip to content

Create a command-line-based library management system using C++. The system should allow users to manage a library's collection of books. Users should be able to add, remove, and search for books, as well as perform other library-related functions.

Notifications You must be signed in to change notification settings

fcmaple/library-manage-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library-Manage-System

Create a command-line-based library management system using C++. The system should allow users to manage a library's collection of books. Users should be able to add, remove, and search for books, as well as perform other library-related functions.

How to use

Server

make && make run [Port]

Client

nc [server IP]:[Port]

Notic: The default server IP is localhost, if you want to set the server IP to public, modify the macro PUBLIC in server.hpp

Specification

Register

The user need to register to be a member when the user connect to library-management-system.

Usage: register

Login

Usage: login

Borrow

When the user want to borrow a e-book/p-book. You can use command books to see all book id. e means the book type is e-book, p means the book type is p-book.

Usage: add [book name/book id] [e/p]

Return

When the user want to borrow a e-book/p-book.

Usage: rm [book name/book id] [e/p]

Read

When the user want to read a e-book. You can input "" to keep reading after command read.

Usage: read [book name/book id] [e/p]

Search

When the user want to check the state of specified book.

Usage: search [book name]

Display personal bookself / all books

When the user want to see all book in the library-management-system.

Usage: books

When the user just want to check how many books in the personal bookshelf.

Usage: mybooks

Implementation detail

Server

On the server side, I establish a socket server. When an external connection is made, I create a new process using fork() to handle that external connection. The stdin, stdout, and stderr of that process can be redirected to the corresponding socket file descriptor.

To handle data that needs to be shared among multiple processes, such as library books and account/password management, I create shared memory. This allows different processes to access and modify the shared data. To deal with synchronization issues when accessing the shared data,I use semaphores.

Client

On the client side, I have written a UI class specifically designed to handle client requests and generate responses based on those requests.

About

Create a command-line-based library management system using C++. The system should allow users to manage a library's collection of books. Users should be able to add, remove, and search for books, as well as perform other library-related functions.

Resources

Stars

Watchers

Forks

Packages

No packages published