From e358e1afe37f3f556bbe7dd981776c9b3c3866cd 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:31:00 +0800 Subject: [PATCH] d --- README.md | 23 +++++++++- c2.svg | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 c2.svg diff --git a/README.md b/README.md index 0670f5e..a90a85d 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,26 @@ 函数原形:void ShowLibInfo(const Book* book, const Reader* reader); 功能:接受两个形参,分别是图书的链表地址,读者的链表地址,并遍历两个链表,显示出图书的数量和读者的数量 ``` - +void ShowLibInfo(const Book* book1, const Reader* reader1) +{ + Book* book = book1; + Reader* reader = reader1; + int bookNUm = 0, readerNUm = 0, mangerNUm = 0; + while (book != NULL) + { + bookNUm++; + book = book->next; + } + while (reader != NULL) + { + readerNUm++; + reader = reader->next; + } + printf("本图书馆共有藏书%d本,读者%d人\n", bookNUm, readerNUm); + printf("按任意键返回\n"); + getchar(); + return; +} ``` @@ -182,7 +201,7 @@ 针对概要设计 C2:void ShowLibInfo(const Book* book, const Reader* reader);\\查询图书馆的总信息 - +![C2](c2.svg) C3:void ShowLibBook(Book* book);\\查询图书馆藏书信息 C4:Book* AddBook(Book* book);\\存入新书 diff --git a/c2.svg b/c2.svg new file mode 100644 index 0000000..5192a7b --- /dev/null +++ b/c2.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + 开始 + + + + + + End + + + + + + + + + + + + + + + + + + + + + Integer Book*book=book1 + Reader*reader=reader1 + + + + + + bookNUm = 0 + + + + + + readerNUm = 0 + + + + + + mangerNUm = 0 + + + + + + + + + + + Output readerNUm + ++; + reader=reader->next; + + + + + + reader!=NULL + + + + True + + + False + + + + + + + + + + + Output readerNUm + ++; + reader=reader->next; + + + + + + reader!=NULL + + + + True + + + False + + + + + + Output printf + ("本图书馆共有藏书%d本, + 读者%d人\n", bookNUm, + readerNUm); + printf + ("按任意键返回\n"); + + + + +