You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
551 B

2 years ago
// 查询图书信息
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);
}
}