|
|
@ -132,3 +132,30 @@ void add_data()
|
|
|
|
|
|
|
|
|
|
|
|
printf("图书信息添加成功!\n");
|
|
|
|
printf("图书信息添加成功!\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 更新图书信息
|
|
|
|
|
|
|
|
void update_data()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int id;
|
|
|
|
|
|
|
|
struct book *p;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("请输入要修改的图书编号:");
|
|
|
|
|
|
|
|
scanf("%d", &id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p = find(id); // 查找编号为id的图书
|
|
|
|
|
|
|
|
if(p != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("请依次输入修改后的图书信息:\n");
|
|
|
|
|
|
|
|
printf("图书名称:");
|
|
|
|
|
|
|
|
scanf("%s", p->name);
|
|
|
|
|
|
|
|
printf("图书作者:");
|
|
|
|
|
|
|
|
scanf("%s", p->author);
|
|
|
|
|
|
|
|
printf("图书价格:");
|
|
|
|
|
|
|
|
scanf("%f", &p->price);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("图书信息修改成功!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("没有找到编号为%d的图书!\n", id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|