diff --git a/query_data.c b/query_data.c new file mode 100644 index 0000000..1aa8a32 --- /dev/null +++ b/query_data.c @@ -0,0 +1,23 @@ +// 查询图书信息 +void query_data() +{ + int id; + struct book *p; + + printf("请输入要查询的图书编号:"); + scanf("%d", &id); + + p = find(id); // 查找编号为id的图书 + if(p != NULL) + { + printf("图书信息如下:\n"); + printf("图书编号:%d\n", p->id); + printf("图书名称:%s\n", p->name); + printf("图书作者:%s\n", p->author); + printf("图书价格:%.2f\n", p->price); + } + else + { + printf("没有找到编号为%d的图书!\n", id); + } +}