|
|
|
@ -109,7 +109,70 @@ void ShowLibBook(Book* book1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//C4
|
|
|
|
|
|
|
|
|
|
Book* AddBook(Book* book1)
|
|
|
|
|
{
|
|
|
|
|
Book* book = book1;
|
|
|
|
|
if (book == NULL)
|
|
|
|
|
{
|
|
|
|
|
Book* tmp = (Book*)malloc(sizeof(Book));
|
|
|
|
|
tmp->next = NULL;
|
|
|
|
|
assert(tmp);
|
|
|
|
|
printf("输入书的编号:");
|
|
|
|
|
scanf("%d", &tmp->iNum);
|
|
|
|
|
getchar();
|
|
|
|
|
printf("输入书的名称:");
|
|
|
|
|
gets(&tmp->acName);
|
|
|
|
|
printf("输入书的作者:");
|
|
|
|
|
gets(tmp->acAuthor);
|
|
|
|
|
printf("输入书的出版社:");
|
|
|
|
|
gets(tmp->acPress);
|
|
|
|
|
printf("输入书的库存量:");
|
|
|
|
|
scanf("%d", &tmp->iAmount);
|
|
|
|
|
book = tmp;
|
|
|
|
|
printf("按任意键返回\n");
|
|
|
|
|
getchar();
|
|
|
|
|
return book;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
while (book->next == NULL)
|
|
|
|
|
{
|
|
|
|
|
int flag = 1;
|
|
|
|
|
while (flag)
|
|
|
|
|
{
|
|
|
|
|
Book* tmp = (Book*)malloc(sizeof(Book));
|
|
|
|
|
tmp->next = NULL;
|
|
|
|
|
assert(tmp);
|
|
|
|
|
printf("输入书的编号:");
|
|
|
|
|
scanf("%d", &tmp->iNum);
|
|
|
|
|
getchar();
|
|
|
|
|
printf("输入书的名称:");
|
|
|
|
|
gets(&tmp->acName);
|
|
|
|
|
printf("输入书的作者:");
|
|
|
|
|
gets(tmp->acAuthor);
|
|
|
|
|
printf("输入书的出版社:");
|
|
|
|
|
gets(tmp->acPress);
|
|
|
|
|
printf("输入书的库存量:");
|
|
|
|
|
scanf("%d", &tmp->iAmount);
|
|
|
|
|
book->next = tmp;
|
|
|
|
|
printf("是否继续输入:1==>继续\t0==>结束\t");
|
|
|
|
|
scanf("%d", &flag);
|
|
|
|
|
getchar();
|
|
|
|
|
if (flag == 0)
|
|
|
|
|
{
|
|
|
|
|
printf("按任意键返回\n");
|
|
|
|
|
getchar();
|
|
|
|
|
return book1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
book = book->next;
|
|
|
|
|
}
|
|
|
|
|
printf("按任意键返回\n");
|
|
|
|
|
getchar();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//C5
|
|
|
|
|
|
|
|
|
|
//C6
|
|
|
|
|