From 8323823e2ca6d3c6d2fe71629630b69c853285ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E5=B2=B1=E7=91=BE?= <3198996150@qq.com> Date: Sun, 21 May 2023 15:07:04 +0800 Subject: [PATCH] c6 --- app.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app.c b/app.c index 9f703d1..80ad9f9 100644 --- a/app.c +++ b/app.c @@ -58,7 +58,6 @@ int main() return 0; } -<<<<<<< HEAD void init() { @@ -94,7 +93,7 @@ void quit() quit(); // 递归调用自己 } } -======= + // 查询图书信息 void query_data() { @@ -118,4 +117,20 @@ void query_data() printf("没有找到编号为%d的图书!\n", id); } } ->>>>>>> abdd42ecb23a7d711b141a7e6ad1be4b1d53f56f + +// 打印图书信息 +void print_data() +{ + struct book *p; + + p = books; // 从全局链表头开始 + while(p != NULL) + { + printf("图书编号:%d\n", p->id); + printf("图书名称:%s\n", p->name); + printf("图书作者:%s\n", p->author); + printf("图书价格:%.2f\n", p->price); + printf("----------------------\n"); + p = p->next; + } +}