Single Linked List Library Management System

1. Single Linked List Basic Concepts

  • Definition: A single linked list is a linear data structure where each element consists of two parts: a data field storing the element's information and a pointer field pointing to the next element.
  • Characteristics:
  • Each node has only one pointer to its successor node.
  • Insertion and deletion operations are relatively simple, as only pointers need to be adjusted, not the elements themselves.

2. Data Structure Definitions

Book Structure

  • Members:
  • book_num: Book number
  • book_name: Book title
  • book_writer: Author name
  • book_kc: Stock quantity
  • book_xy: Unknown attribute, possibly book category or other metadata
  • next: Pointer to the next node
  • Purpose: Stores book-related information and connects the books into a linked list.

Reader Structure

  • Members:
  • reader_num: Reader number
  • reader_name: Reader name
  • right: Reader's permission (possibly borrowing rights)
  • borrow[Max]: Array storing up to Max borrow records
  • next: Pointer to the next node
  • Purpose: Stores reader information and borrowing records, connected into a linked list.

Borrow Record Structure

  • Members:
  • borrow_book_num: Borrowed book number
  • limit_date: Return date
  • Purpose: Stores the borrowing information for a reader.

3. Main Features

Initialization

  • Init(): Initializes the entire system, including books and readers.
  • Init_reader() and Init_book(): Initialize reader and book data respectively.

Book Management

  • Insert_New_Book(): Adds new book information to the system.
  • Find_Book(): Finds specific book information.
  • Print_book(): Prints all book information.

Reader Management

  • Find_Reader(): Finds specific reader information.
  • Print_reader(): Prints all reader information.

Borrow Management

  • Borrow_Book(): Handles book borrowing operations.
  • Return_Book(): Handles book return operations.

Data Persistence

  • Save(), Save_Reader(), Save_Book(): Saves the current system data to a file for future restoration.
  • Load(), Load_Reader(), Load_Book(): Loads previously saved data from a file.

4. User Interaction

  • Login(): Login interface.
  • Menu(): Main menu display.
  • Menu_select(): Executes the corresponding function based on user selection.

5. Other Details

  • The system uses standard C library functions like #include and #include for string manipulation and memory allocation.
  • system("cls") is used to clear the screen, which is effective in Windows environments.
  • Functionality is implemented using switch statements, making the program's logic clearer.

The Single Linked List Library Management System efficiently manages book, reader, and borrowing information with simple functionalities like adding, querying, borrowing, and returning books. It also supports data persistence, making it practical for beginners to learn about linked lists and basic file operations.

txt 文件大小:15.72KB