|
|
@ -138,7 +138,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
函数原形:void returnBook(Reader* reader, Book* book);
|
|
|
|
函数原形:void returnBook(Reader* reader, Book* book);
|
|
|
|
功能:接受两个形参:读者链表地址和图书链表地址,用读者的编号进行匹配,找到该读者后,用图书的编号进行匹配,进行还书,否则返回
|
|
|
|
功能:接受两个形参:读者链表地址和图书链表地址,用读者的编号进行匹配,找到该读者后,用图书的编号进行匹配,进行还书,否则返回
|
|
|
|
|
|
|
|
```
|
|
|
|
void returnBook(Reader* reader1, Book* book1)
|
|
|
|
void returnBook(Reader* reader1, Book* book1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Reader* reader = reader1;
|
|
|
|
Reader* reader = reader1;
|
|
|
@ -191,7 +191,7 @@ void returnBook(Reader* reader1, Book* book1)
|
|
|
|
return reader1;
|
|
|
|
return reader1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -201,6 +201,7 @@ void returnBook(Reader* reader1, Book* book1)
|
|
|
|
|
|
|
|
|
|
|
|
1)函数原形: void save(Book* book);
|
|
|
|
1)函数原形: void save(Book* book);
|
|
|
|
2) 功能:接受一个形参:book的链表地址,新建一个文件,将链表中的信息保存到硬盘中
|
|
|
|
2) 功能:接受一个形参:book的链表地址,新建一个文件,将链表中的信息保存到硬盘中
|
|
|
|
|
|
|
|
```
|
|
|
|
void save(Book* book1)
|
|
|
|
void save(Book* book1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FILE* fp;
|
|
|
|
FILE* fp;
|
|
|
@ -230,13 +231,13 @@ void save(Book* book1)
|
|
|
|
printf("保存文件的数据数目为:%d\n", iCount);
|
|
|
|
printf("保存文件的数据数目为:%d\n", iCount);
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## C12:读取信息模块
|
|
|
|
## C12:读取信息模块
|
|
|
|
|
|
|
|
```
|
|
|
|
1)函数原形: Book* read1();
|
|
|
|
1)函数原形: Book* read1();
|
|
|
|
2) 功能:打开一个文件,将文件中的信息读取到内存中,并返回一个Book类型的指针
|
|
|
|
2) 功能:打开一个文件,将文件中的信息读取到内存中,并返回一个Book类型的指针
|
|
|
|
|
|
|
|
|
|
|
@ -267,7 +268,7 @@ Book* read1()
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
return pHead;
|
|
|
|
return pHead;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|