#include
#include
#include
#include
#define NULL 0
#define LEN sizeof(Book)
struct A
{char Name[20];
int all,left,borrow;
struct A *next;
};
typedef struct A Book;
int Display_Main_Menu(); /*主菜单显示*/
Book *Create(); /*功能函数声明*/
void Display(Book *head);
Book *Insert(Book *head,Book *s);
Book *Insert_a_record(Book *head);
Book *Delete(Book *head,char *name);
Book *Delete_a_record(Book *head);
Book *Borrow(Book *head,char *name,int sum);
Book *Borrow_a_Book(Book *head);
Book *Return(Book *head,char *name,int sum);
Book *Return_a_Book(Book *head);
Book *Query(Book *head,char *name);
void Query_a_record(Book *head);
Book *AddfromText(Book *head,char *filename);
Book *WritetoText(Book *head,char *filename);
void Quit(Book *head);
void main() /*主函数部分*/
{Book *head; /*定义变量*/
char filename[20];
int keyword=111,a;
printf("Please input keyword:");
scanf("%d",&a);
if(a!=keyword) exit(0);
else printf("Welcome!");
head=NULL; /*置首指针为空*/
for(;;)
{
switch(Display_MainMenu())
{
case 1:printf("1.Create BookList\n"); /*调用Create函数创建链表*/
head=Create();
system("pause");
break;
case 2:printf("Display All Books\n");
Display(head); /*调用Display函数显示所有*/
system("pause");break;
case 3:printf("Insert a Record\n");
head=Insert_a_record(head);/*调用Insert_a_record函数插入*/
system("pause");break;
case 4:printf("Delete a Book\n");
head=Delete_a_record(head);/*调用Delete_a_record函数删除*/
system("pause");break;
case 5:printf("Borrow a Book\nInput BookName and sum you borrow:");
head=Borrow_a_Book(head);
system("pause");break;
case 6:printf("Return a Book\nInput BookName and sum you return:");
head=Return_a_Book(head);
system("pause");break;
case 7:printf("Query\nInput the BookName you want:");
Query_a_record(head);/*调用查询函数*/
system("pause");break;
case 8:printf("Input the nam