|
|
@ -2,6 +2,14 @@
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "data.h"
|
|
|
|
#include "data.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct book{
|
|
|
|
|
|
|
|
int id;
|
|
|
|
|
|
|
|
char name;
|
|
|
|
|
|
|
|
char author;
|
|
|
|
|
|
|
|
float price;
|
|
|
|
|
|
|
|
struct book *next;
|
|
|
|
|
|
|
|
}*books;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -98,13 +106,6 @@ int make_choice(void)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int confirm(const char* msg)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char c = 'n'; // 默认选择是 no
|
|
|
|
|
|
|
|
printf("%s(Y/N): ", msg); // 提示输入 yes/no 进行确认
|
|
|
|
|
|
|
|
scanf(" %c%*[^\n]", &c); // 读取第一个字符,忽略剩余字符
|
|
|
|
|
|
|
|
return c == 'y' || c == 'Y'; // 返回确认结果
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 添加新图书信息
|
|
|
|
// 添加新图书信息
|
|
|
|
void add_data()
|
|
|
|
void add_data()
|
|
|
|
{
|
|
|
|
{
|
|
|
|