From 1c63c90e2a7e19b6758dce977d23820f7742f138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=89=BA=E5=93=B2?= <446062334@qq.com> Date: Sun, 21 May 2023 10:19:28 +0800 Subject: [PATCH] vvv --- 图书管理系统.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/图书管理系统.c b/图书管理系统.c index 65fd211..46285b1 100644 --- a/图书管理系统.c +++ b/图书管理系统.c @@ -89,6 +89,56 @@ void ShowMainMenu() //C9 //C10 +void returnBook(Reader* reader1, Book* book1) +{ + Reader* reader = reader1; + Book* book = book1; + printf("请输入读者的id:"); + int id; + scanf("%d", &id); + getchar(); + if (reader != NULL) + { + while (reader != NULL) + { + if (id == reader->iNum) + { + printf("请输入要还的书的编号:"); + int id_book; + scanf("%d", &id_book); + getchar(); + for (int i = 0; i < reader->iMax; i++) + { + if (reader->aiBookId[i] == id_book) + { + reader->aiBookId[i] = 0; + while (book) + { + if (id_book == book->iNum) + { + book->iAmount++; + printf("还书成功!\n"); + printf("按任意键返回\n"); + getchar(); + return reader1; + } + book = book->next; + } + } + } + printf("没有找到该图书,检查图书的Id\n"); + printf("按任意键返回\n"); + getchar(); + return reader1; + } + reader = reader->next; + } + printf("没有找到该读者,检查读者id是否输入有误\n"); + printf("按任意键返回\n"); + getchar(); + return reader1; + } +} //C11