From da9cd31f0d6fbf6a7a498b8c5ece82c8de44c95d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E6=A5=A0?= <87896121@qq.com>
Date: Sun, 21 May 2023 15:56:17 +0800
Subject: [PATCH] liuchengtu
---
README.md | 118 ++++++++++++++++++++-
images/c2.svg | 128 +++++++++++++++++++++++
images/c3.svg | 75 ++++++++++++++
images/c4.svg | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++
images/c5.svg | 183 ++++++++++++++++++++++++++++++++
5 files changed, 780 insertions(+), 5 deletions(-)
create mode 100644 images/c2.svg
create mode 100644 images/c3.svg
create mode 100644 images/c4.svg
create mode 100644 images/c5.svg
diff --git a/README.md b/README.md
index c96eba2..bb043e4 100644
--- a/README.md
+++ b/README.md
@@ -106,7 +106,18 @@ void ShowLibInfo(const Book* book1, const Reader* reader1)
1) 函数原形: void ShowLibBook(Book* book);
2) 功能: 接受一个形参:图书的链表地址,遍历该链表,显示出所有图书的信息
```
-
+void ShowLibBook(Book* book1)
+{
+ Book* book = book1;
+ while (book != NULL)
+ { // \t :制表符
+ printf("%d\t%s\t%s\t%s\t%d\n", book->iNum, book->acName, book->acAuthor, book->acPress, book->iAmount);
+ book = book->next;
+ }
+ printf("\n按任意键返回\n");
+ getchar();
+ return;
+}
@@ -117,7 +128,70 @@ void ShowLibInfo(const Book* book1, const Reader* reader1)
1) 函数原形: Book* AddBook(Book* book);
2) 功能: 接受一个形参:图书的链表地址,利用尾插对链表进行修改,添加图书
```
-
+Book* AddBook(Book* book1)
+{
+ Book* book = book1;
+ if (book == NULL)
+ {
+ Book* tmp = (Book*)malloc(sizeof(Book));
+ tmp->next = NULL;
+ assert(tmp);
+ printf("输入书的编号:");
+ scanf("%d", &tmp->iNum);
+ getchar();
+ printf("输入书的名称:");
+ gets(&tmp->acName);
+ printf("输入书的作者:");
+ gets(tmp->acAuthor);
+ printf("输入书的出版社:");
+ gets(tmp->acPress);
+ printf("输入书的库存量:");
+ scanf("%d", &tmp->iAmount);
+ book = tmp;
+ printf("按任意键返回\n");
+ getchar();
+ return book;
+ return;
+ }
+ while (1)
+ {
+ while (book->next == NULL)
+ {
+ int flag = 1;
+ while (flag)
+ {
+ Book* tmp = (Book*)malloc(sizeof(Book));
+ tmp->next = NULL;
+ assert(tmp);
+ printf("输入书的编号:");
+ scanf("%d", &tmp->iNum);
+ getchar();
+ printf("输入书的名称:");
+ gets(&tmp->acName);
+ printf("输入书的作者:");
+ gets(tmp->acAuthor);
+ printf("输入书的出版社:");
+ gets(tmp->acPress);
+ printf("输入书的库存量:");
+ scanf("%d", &tmp->iAmount);
+ book->next = tmp;
+ printf("是否继续输入:1==>继续\t0==>结束\t");
+ scanf("%d", &flag);
+ getchar();
+ if (flag == 0)
+ {
+ printf("按任意键返回\n");
+ getchar();
+ return book1;
+ }
+ }
+ }
+ book = book->next;
+ }
+ printf("按任意键返回\n");
+ getchar();
+ return;
+}
@@ -128,7 +202,39 @@ void ShowLibInfo(const Book* book1, const Reader* reader1)
1)函数原形: Book* DealoldBook(Book* book);
2) 功能: 接受一个形参:图书链表的地址,遍历该链表,用书的编号进行匹配,找到该图书后删除该图书,否则返回
```
-
+Book* DealoldBook(Book* book1)
+{
+ Book* book = book1;
+ Book* prev = book1;
+ printf("输入要处理旧书的编号:");
+ int id;
+ scanf("%d", &id);
+ getchar();
+ while (book != NULL)
+ {
+ if (id == book->iNum)
+ {
+ if (book1 == book)
+ {
+ book = book->next;
+ free(prev);
+ return book;
+ }
+ prev->next = book->next;
+ free(book); // free():释放资源
+ printf("已将旧书处理掉!\n");
+ printf("按任意键返回\n");
+ getchar();
+ return book1;
+ }
+ prev = book;
+ book = book->next;
+ }
+ printf("没有找到该图书\n");
+ printf("按任意键返回\n");
+ getchar();
+ return book1;
+}
```
@@ -225,11 +331,13 @@ void ShowLibInfo(const Book* book1, const Reader* reader1)
C2:void ShowLibInfo(const Book* book, const Reader* reader);\\查询图书馆的总信息
![C2](c2.svg)
C3:void ShowLibBook(Book* book);\\查询图书馆藏书信息
-
+![c3](images/c3.svg)
+)
C4:Book* AddBook(Book* book);\\存入新书
+![c4](images/c4.svg)
C5:Book* DealoldBook(Book* book);\\旧书处理
-
+![c5](images/c5.svg)
C6:void foundBook(Book* book);\\根据书名检索书刊信息
C7:void foundReader_Info(Reader* reader);\\查询读者的借阅信息
diff --git a/images/c2.svg b/images/c2.svg
new file mode 100644
index 0000000..5192a7b
--- /dev/null
+++ b/images/c2.svg
@@ -0,0 +1,128 @@
+
+
+
+
diff --git a/images/c3.svg b/images/c3.svg
new file mode 100644
index 0000000..2492f51
--- /dev/null
+++ b/images/c3.svg
@@ -0,0 +1,75 @@
+
+
+
+
diff --git a/images/c4.svg b/images/c4.svg
new file mode 100644
index 0000000..3ce429f
--- /dev/null
+++ b/images/c4.svg
@@ -0,0 +1,281 @@
+
+
+
+
diff --git a/images/c5.svg b/images/c5.svg
new file mode 100644
index 0000000..50c3f7b
--- /dev/null
+++ b/images/c5.svg
@@ -0,0 +1,183 @@
+
+
+
+