# contains "stdio.h"
# contains "stdlib.h"
# contains "conio.h"
# contains "string.h"
# contains "math.h"
#define LEN sizeof (structure library)
#define LEN 1 sizeof (structure reader)
# Define NULL 0
Structure library//library structure
{int shuhao, xcl
Character name [20], author [20], publisher [20];
Structure library * next
};
Structure reader//reader structure
{
Within Zheng Hao;
Xia Erziming [20], Riqi [20], Zname [20];
Structure reader * next
};
Void mainmenu() // displays the main menu.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf ("\ t \ t \ t 1。 Library information \ n \ n ");
Printf ("\ t \ t \ t 2。 Lending system \ n \ n ");
Printf ("\ t \ t \ t 3。 Log out of the system \ n \ n ");
Printf ("\ t \ t \ tplease press the key to select and press enter to confirm \ n");
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Return;
}
Voidmenu1()/displays the library information menu.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf ("\ t \ t \ t 1。 Edit warehousing \ n \ n ");
Printf ("\ t \ t \ t 2。 Clear inventory \ n \ n ");
Printf ("\ t \ t \ t 3。 Book query \ n \ n ");
Printf ("\ t \ t \ t 4。 Inventory list \ n \ n ");
Printf ("\ t \ t \ t 5。 Go back to the previous level \ n \ n ");
Printf ("\ t \ t \ tplease press the key to select and press enter to confirm \ n");
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Return;
}
Void menu2() // displays the query menu.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf ("\ t \ t \ t 1。 ISBN query \ n \ n ");
Printf ("\ t \ t \ t 2。 Title query \ n \ n ");
Printf ("\ t \ t \ t 3。 Author query \ n \ n ");
Printf ("\ t \ t \ t 4。 By query \ n \ n ");
Printf ("\ t \ t \ tplease press the key to select and press enter to confirm \ n");
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Return;
}
Void main()// main function, calling main 1
{ void main 1();
main 1(); }
Voidmain1()/main1function
{ void TSG xx(); //statement
Void borrows a number to pass interest (); //statement
Char selection;
main menu();
Scanf("%c ",& select);
Toggle (Select)//Function Selection
{ case ' 1 ':tsgxx(); Break;
Case '2': Jieshuxitong (); Break;
Case "3": System ("CLS"); Printf ("\ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t Bye-bye ..."); Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t \ tWelcome to use this software! ! !" ); getch(); Exit (0); System ("CLS"); Break;
}
}
Void tsgxx()// library information function
{ void ts jinku();
void shanchu();
void chax unts();
void xianshikucun(); //Function declaration
Char selection;
menu 1(); //Call menu function
Scanf("%c ",& select);
Scanf("%c ",& select);
for(; ; )
Toggle (Select)//Function Selection
{ case ' 1 ':tsjinku(); Break;
Case' 2': Shanchu (); Break;
Case "3": chaxunts (); Break;
case ' 4 ':xianshikucun(); Break;
Case "5": main1(); Break;
}
}
Int tjzs()// Statistical Text Quantity Function
{ FILE * fp
int tshuhao=0,txcl=0,n;
char tname[20]={'\0'},tauthor[20]={'\0'},tchuban[20]= { ' \ 0 ' };
fp=fopen("library.txt "," r "); //Open the file
for(n = 0; ! feof(FP); N++)// Read files one by one.
Fscanf(fp, "%d% s% s% d",&Chu Hao, Turner, Tao Se, Chu Ban. txcl);
n-;
fclose(FP); //Close the file
Return (n); //Returns a number
}
Int tjdzs()// Statistical Text Quantity Function
{ FILE * fp
Int Zheng Hao =0, n;
Char Ziming [20]={'\0'}, Riqi [20]={'\0'}, Zname [20] = {'\ 0'};
fp=fopen("reader.txt "," r "); //Open the file
for(n = 0; ! feof(FP); N++)// Read files one by one.
Fscanf(fp, "%d% s% s", & Zheng Hao & Ziming & Japanese enterprise & Ampzname);
fclose(FP); //Close the file
Return (n); //Returns a number
}
Void tsjinku()// library entry function
{ FILE * fp
int shuhao=0,xcl=0,n = 0;
char name[20]={'\0'},author[20]={'\0'},chuban[20]= { ' \ 0 ' };
char hitkey
System ("CLS");
If ((FP = fopen ("library. Txt ","r ")= = null)// Open the library file and create it if it doesn't exist.
{ fp=fopen("library.txt "," w ");
fclose(FP);
}
fp=fopen("library.txt "," a ");
Printf ("\ n \ n \ n \ t \ t \ t \ t \ tPlease enter the book information in the following format: \ t \ t \ tBook number, title, number of books entered by publisher \ nPlease enter:"); //Enter the library information in format.
for(; Hit the key! =27; )//Cyclic input
{ if (n! =0)
Printf ("Please enter:");
Scanf("%d%s%s%s%d ",& book number, name, author, publisher, author. xcl);
Fprintf(fp, "%d% s% s% d \ n", bookseller, name, author, Chu Ban, XCL);
Printf ("Press enter to continue input, press esc\n to end input \ n");
n++;
hitkey = getch();
for(; Hit the key! = 13。 & keystroke! =27; )
hitkey = getch();
}
fclose(FP);
Printf(" \ n \ n \ n \ n \ n \ n \ t \ t tSaved successfully, press any key to return to the previous level! " );
getch();
tsgxx(); //Return to the previous level
}
Void shanchu()// Delete book information function
{ struct library * head = NULL
Structure library *p, *p 1, * p2
int tshuhao=0,txcl=0,n=0,j,I;
char tname[20]={'\0'},tauthor[20]={'\0'},tchuban[20]={'\0'},TT name[20]= { ' \ 0 ' };
char hitkey
FILE * fp
If ((FP = fopen ("library.txt ","r ")= = null)// Open the file.
{ system(" cls ");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t The log file does not exist! Press any key to return ... ");
getch();
tsgxx();
}
other
{ system(" cls ");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t tPlease enter the title of the book you want to delete: "); //Enter the name of the deleted book.
scanf("%s ",& ampTT name);
Printf ("\ t \ tpress enter to confirm deletion, or press ESC \ nCancel \ n");
hitkey = getch();
for(; Hit the key! = 13。 & keystroke! =27; )
hitkey = getch();
if (hitkey==27)
tsgxx();
fp=fopen("library.txt "," r ");
for(j = 0; ! feof(FP); )//Read the folder information and count the number.
{ j++;
Fscanf(fp, "%d% s% s% d",&Chu Hao, Turner, Tao Se, Chu Ban. txcl);
}
fclose(FP);
fp=fopen("library.txt "," r ");
for(I = 1; I & ltj;; i++)
{fscanf(fp, "%d% s% s% d",&Chu Hao, Turner, Tao Se, Chu Ban. txcl);
If (strcmp(ttname, tname))// Compare names and copy information with different names into the linked list.
{ n++;
If (n== 1)// Create a linked list.
{p 1=p2= (structure library *) malloc (len);
head = p 1;
}
other
{ p2->; next = p 1;
p2 = p 1;
P 1= (structure library *) malloc (len); //Create a new linked list
}
p 1->; Shuhao = tshuhao// Copy ISBN
strcpy(p 1->; Name, tname); //Copy the title of the book
strcpy(p 1->; Author, Tauser); //Copy the author's name
strcpy(p 1->; chuban,tchu ban); //Copy Publishing House
p 1->; Xcl = txcl// number of copies
}
}
If (n==0)
{ head = NULL
}
other
{
p2->; next = p 1;
p 1->; next = NULL
fclose(FP);
}
}
fp=fopen("library.txt "," w "); //Clear files
fclose(FP);
fp=fopen("library.txt "," a "); //Append file
P = head;
for(; p! = NULL)// Overwrite the contents of the linked list into the file.
{
fprintf(fp," %d %s %s %s %d \n ",p-& gt; Shu Hao, P-> Name, p-> Author, P-> chuban,p-& gt; xcl);
p = p-& gt; Next;
}
fclose(FP); //Close the file
System ("CLS");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ t \ t tSuccessfully deleted \ n \ tPress any key to return to the previous level \ n ");
getch(); //Return to the previous level
tsgxx();
}
Void chaxunts()// query function
{
FILE * fp
Char selection;
int ttshuhao=0,tshuhao=0,txcl=0,n=0,k=0,I,l;
char tname[20]={'\0'},ttauthor[20]={'\0'},tauthor[20]={'\0'},ttchuban[20]={'\0'},tchuban[20]={'\0'},TT name[20]= { ' \ 0 ' };
If ((FP = fopen ("library.txt ","r ")= = null)// Open the file.
{ system(" cls ");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t The log file does not exist! Press any key to return ... ");
getch();
tsgxx();
}
l = tjzs(); //Get the number of files
menu 2(); //Call menu function
Scanf("%c ",& select); Scanf("%c ",& select); //Select the query method
if (choose=='5 ')
Return;
Elseif (choose ='1')//ISBN query
{ system(" cls ");
Printf ("Please enter ISBN:");
scanf("%d ",& ampttshuhao);
}
other
If (choose=='2')// Title query
{ system(" cls ");
Printf ("Please enter a title:");
scanf("%s ",TT name);
}
other
If (choose=='3')// author query
{ system(" cls ");
Printf ("Please enter the author:");
scanf("%s ",TT author);
}
other
If (choose=='4')// By query
{ system(" cls ");
Printf ("Please enter publisher:");
scanf("%s ",ttchuban);
}
System ("CLS");
for(I = 0; I & ltl;; i++)
{fscanf(fp, "%d% s% s% d",&Chu Hao, Turner, Tao Se, Chu Ban. txcl); //Read file information
if (ttshuhao==tshuhao||! strcmp(ttname,tname)||! strcmp(ttauthor,tauthor)||! Strcmp(ttchuban, tchuban))///Output query information.
{
If (k==0)
{
Printf ("\ t \ t \ t \ tQuery result: \ n \ n");
Printf(" \ t ISBN, title, author publishing house \ n ");
}
printf(" \ t %-4d %-8s %-8s %-4d \ n ",tshuhao,tname,tauthor,tchuban,txcl);
k++;
}
}
If (k==0)// If the folder is empty, no records will be output.
{ system(" cls ");
Printf ("\ n \ n \ n \ n \ n \ n \ n \ t \ tNo matching record! \ n ");
getch();
tsgxx();
}
fclose(FP);
getch(); //Return
tsgxx();
}
Void xianshikucun()// Actual inventory information
{
FILE * fp
int shuhao=0,xcl=0,n=0,i=0,j = 0;
char name[20]={'\0'},author[20]={'\0'},chuban[20]= { ' \ 0 ' };
If ((fp = fopen ("library.txt ","r ")= = null)// Open the folder.
{
System ("CLS");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t The log file does not exist! " );
}
n = tjzs();
If (n==0)
{ system(" cls ");
Printf ("\ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ tNo record!" );
}
fp=fopen("library.txt "," r ");
System ("CLS");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Printf(" \ t ISBN title author publishing house directory \ n ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
for(I = 0; I & ltn;; I++)// Output information
{
Fscanf(fp, "%d% s% s% d", & book number, name, author, publisher, author. xcl);
Printf(" \ t %-4d %-8s %-8s %-4d \ n ",book name, author, Chu Ban, XCL);
}
fclose(FP);
Printf ("\ t \ t \ t \ tPress any key to return \ n");
getch(); //Return
tsgxx();
}
Void menu3() // Displays the main menu of the borrowing system.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf ("\ t \ t \ t 1。 Book lending registration \ n \ n ");
Printf ("\ t \ t \ t 2。 Book return registration \ n \ n ");
Printf ("\ t \ t \ t 3。 Check the borrowing situation \ n \ n ");
Printf ("\ t \ t \ t 4。 Go back to the previous level \ n \ n ");
Printf ("\ t \ t \ tplease press the key to select and press enter to confirm \ n");
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Return;
}
Void jieshuxitong()// Borrow system function
{void Shu Jie ();
void huanshu();
void duzheilang(); //Function declaration
Char selection;
menu 3();
Scanf("%c ",& select);
Scanf("%c ",& select); //Select function
for(; ; )
Switch (Select)//Call Function
{case' 1': Shu Jie (); Break;
Case' 2': Huan Shu (); Break;
case ' 3 ':duzheilang(); Break;
Case "4": main1(); Break;
}
}
Void Shu Jie ()//Borrow function
{
FILE *fp,* fp3
struct library * head = NULL
Structure library *p, *p 1, * p2
Int tshuhao=0, txcl=0, I, loop, Zheng Hao =0, n=0, k=0, t=0, flag = 0;;
Char tname[20]={'\0'}, tauthor[20]={'\0'}, tchuban[20]={'\0'}, ttname[20]={'\0'}, Zi Ming [20] = {'
char hit key = 0;
System ("CLS");
{
If ((FP = fopen ("library.txt ","r ")= = null)// Open the library file.
{
System ("CLS");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t The library is out of stock! Press any key to exit! ”);
getch();
Exit (0);
}
other
{
{
Printf(" \ n \ n \ n \ t \ t \ t \ t \ t tPlease enter the book name: \ t \ t \ tPlease enter: "); //Enter the title of the book
scanf("%s ",zname);
k = tjzs(); //Count the number of library documents.
for(I = 0; I & ltk;; I++)// Read the library information and store it in the linked list.
{
Fscanf(fp, "%d% s% s% d",&Chu Hao, Turner, Tao Se, Chu Ban. txcl);
n++;
If (n== 1)
{p 1=p2= (structure library *) malloc (len);
head = p 1;
}
other
{ p2->; next = p 1;
p2 = p 1;
P 1= (structure library *) malloc (len); //Create a new linked list
}
p 1->; Shuhao = tshuhao// Copy ISBN
strcpy(p 1->; Name, tname); //Copy the title of the book
strcpy(p 1->; Author, Tauser); //Copy the author
strcpy(p 1->; chuban,tchu ban); //Copy Publishing House
p 1->; Xcl = txcl// Copy on-hand quantity
}
If (n==0)
head = NULL
other
{
p2->; next = p 1;
p 1->; next = NULL
fclose(FP);
}
}
}
P = head;
for(; p! = NULL)// Read the linked list
{
If (! (strcmp(p-& gt; Name, zname)))//)///)/with the same name
{ flag = 1; //The tag is 1.
loop = p-& gt; Xcl// quantity on hand minus 1
(p->; xcl)-; }
p = p-& gt; Next;
}
If (logo &&(loop & gt0)//has a book borrowing title and the quantity on hand is greater than 0.
{ fp=fopen("library.txt "," w ");
fclose(FP);
fp=fopen("library.txt "," a ");
P = head;
for(; p! = NULL)
{
fprintf(fp," %d %s %s %s %d \n ",p-& gt; Shu Hao, P-> Name, p-> Author, P-> chuban,p-& gt; xcl);
p = p-& gt; Next;
}
Free (p); //Overwrite the file with the contents of the linked list.
fclose(FP); }
If (logo &&(loop & gt0)//has a book borrowing title and the quantity on hand is greater than 0.
{
{
If ((fp3 = fopen ("reader.txt ","r ")= = null)// Create a reader folder.
{ fp3=fopen("reader.txt "," w ");
fclose(fp3);
}
fp3=fopen("reader.txt "," a ");
}
{
{ if (n! =0)
Printf ("\ n \ n \ n \ n \ n \ n \ t \ tPlease enter the card reader information in the following format: \ t \ t \ t \ certificate number return date name \ nPlease enter:"); //Enter reader information
Scanf("%d %s %s %s ",& Zheng Hao & Ziming [20], & Riqi [20], & Ampzname [20]);
Fprintf(fp3, "%d% s% s \ n", Zheng Hao&Zi Ming [20], & Riqi [20], & Ampzname [20]);
fp=fopen("library.txt "," w "); //Delete library file information
fclose(FP);
fp=fopen("library.txt "," a "); //Add information again
P = head;
for(; p! = NULL)// Overwrite the contents of the linked list with the library file.
{
fprintf(fp," %d %s %s %s %d \n ",p-& gt; Shu Hao, P-> Name, p-> Author, P-> chuban,p-& gt; xcl);
p = p-& gt; Next;
}
fclose(FP);
fclose(fp3);
Printf ("Success! Press any key to return \ n ");
getch(); //Return
Relieve summer heat and relieve pain ();
}
}
Relieve summer heat and relieve pain ();
}
other
Printf ("This book has been borrowed! Press any key to return! ”); //Otherwise, the output book has been connected.
getch(); //Return
Relieve summer heat and relieve pain ();
}
}
Void huanshu()// returns the function.
{FILE *fp,* fp3
struct reader * head = NULL
Structure reader *p, *p 1, * p2
Structure library * lhead1= null;
Structure library *zp 1, *lp 1, * lp2
int tshuhao=0,txcl=0,I;
char tname[20]={'\0'},tauthor[20]={'\0'},tchuban[20]={'\0'},TT name[20]= { ' \ 0 ' };
int ttzhenghao=0,tzhenghao = 0,n=0,k=0,t=0,flag = 0;
char tmingzi[20]={'\0'},triqi[20]={'\0'},tzname[20]={'\0'},ttz name[20]= { ' \ 0 ' };
char hit key = 0;
System ("CLS");
{
If ((FP = fopen ("reader。 Txt ","r ")= = null)// If there is no reader file, the output cannot be returned.
{
System ("CLS");
Printf ("\ n \ n \ n \ n \ n \ n \ n \ n \ nNo borrower! Press any key to exit! ”);
getch();
Exit (0);
}
other
{
{
Printf(" \ n \ n \ n \ n \ n \ n \ t \ t tPlease enter the reader ID number and book title: \ t \ t \ t \ Please enter: ");
scanf("%d %s ",& ampttzhenghao,ttz name); //Enter the card number and title of the book to be returned.
k = tjdzs(); //Get the number of reader folder information.
for(I = 0; I & ltk;; I++)// Read the reader folder information.
{
fscanf(fp," %d%s%s%s\n ",& amptzhenghao,tmingzi,triqi,tz name);
if((TT Zheng Hao = = tzeng Hao)& amp; & amp! Strcmp(ttzname, tzname))// If the title of the certificate number exists, it is marked as 1.
flag = 1;
}
fclose(FP);
fp=fopen("reader.txt "," r "); //Open the reader file
If (logo)
{
for(I = 0; I & ltk;; I++)// Copy the reader file to the linked list.
{
fscanf(fp," %d%s%s%s\n ",& amptzhenghao,tmingzi,triqi,tz name); //Read file information
If (! ((TT Zheng Hao = = tzeng Hao)& amp; & amp! strcmp(ttzname,tzname)))
{ n++;
If (n== 1)
{ p 1 = p2 =(struct reader *)malloc(l EN 1); //Create a new linked list
head = p 1;
}
other
{ p2->; next = p 1;
p2 = p 1;
P 1= (structure reader *) malloc (en1); //Create a new linked list
}
p 1->; Zheng Hao = Hao Zheng; //Copy the certificate number
strcpy(p 1->; Zi Ming, tmingzi); //Copy the reader's name
strcpy(p 1->; Richie, Tredge); //Copy date
strcpy(p 1->; zname,tz name); //Copy the title of the book
}
}
If (n==0)
head = NULL
other
{
p2->; next = p 1;
p 1->; next = NULL
fclose(FP);
}
fp=fopen("reader.txt "," w "); //Clear the reader file
fclose(FP);
fp=fopen("reader.txt "," a "); //Additional information
P = head;
for(; p! = NULL)// Overwrite the contents of the linked list to the reader file.
{
fprintf(fp," %d %s %s %s \n ",p-& gt; Zheng Hao, P-> Zi Ming, P-> Riqi, P-> zname);
p = p-& gt; Next;
}
Free (p);
fclose(FP);
}
}
}
}
If(flag)// marked as 1, when returning the book.
{
{
{printf ("Please press Enter to confirm the return of the book!" );
for(; Hit the key! = 13。 & keystroke! =27; )
hitkey = getch();
if (hitkey== 13)
Printf ("Success! Press any key to return! ”);
n = 0; flag = 0;
fp3=fopen("library.txt "," r "); //Open the library file
k = tjzs(); //Get the number of library files
for(I = 0; I & ltk;; I++)// Copy the library file to the linked list.
{
Fscanf(fp3, "%d% s% s% d",&Chu Hao, Turner, Tao Se, Chu Ban. txcl); //Read information
n++;
If (n== 1)
{lp 1=lp2= (structural library *) malloc (len); //Create a new linked list
lhead 1 = LP 1;
}
other
{ lp2->; next = LP 1;
lp2 = LP 1;
Lp 1= (structure library *) malloc (len); //Create a new linked list
}
LP 1->; Shuhao = tshuhao// Copy ISBN
strcpy(LP 1->; Name, tname); //Copy the title of the book
strcpy(LP 1->; Author, Tauser); //Copy the author
strcpy(LP 1->; chuban,tchu ban); //Copy Publishing House
LP 1->; Xcl = txcl// Copy on-hand quantity
}
If (n==0)
{ lhead 1 = NULL;
}
other
{
lp2->; next = LP 1;
LP 1->; next = NULL
fclose(fp3);
}
}
}
ZP 1 = lhead 1;
for(; zp 1! = NULL)
{
If (! (strcmp(ZP 1->; Name, ttzname))//)/Find the same title.
++(ZP 1->; xcl); //existing quantity plus 1
ZP 1 = ZP 1-& gt; Next;
}
fp3=fopen("library.txt "," w "); //Empty the library file
fclose(FP);
fp3=fopen("library.txt "," a "); //Additional information
ZP 1 = lhead 1;
for(; zp 1! = NULL)// Overwrite the contents of the linked list with the library file.
{
fprintf(fp3," %d %s %s %s %d \n ",ZP 1-& gt; Shu Hao, ZP1-> Name, ZP1->; Author, ZP1->; chuban,ZP 1->; xcl); //Enter information
ZP 1 = ZP 1-& gt; Next;
}
fclose(fp3);
getch(); //Return
Relieve summer heat and relieve pain ();
}
other
Printf ("This information does not exist! Press any key to return! ”);
getch(); //Return
Relieve summer heat and relieve pain ();
}
Void duzheilang()// Displays the borrowing function.
{
FILE * fp
Int Zheng Hao =0, xcl=0, n=0, i=0, j = 0;;
Char Ziming [20]={'\0'}, Riqi [20]={'\0'}, Zname [20] = {'\ 0'};
If ((FP = fopen ("reader.txt ","r ")= = null)// Open the reader folder.
{
System ("CLS");
Printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t The log file does not exist! " );
}
n = tjdzs();
If (n==0)
{ system(" cls ");
Printf ("\ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ tNo record!" );
}
fp=fopen("reader.txt "," r ");
System ("CLS");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf(" \ tReader ' s name with certificate number,book return date,book title \n ")。
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
for(I = 0; I & ltn;; I++)// Output file information
{
Fscanf(fp, "%d% s% s \ n", & Zheng Hao, Ziming, Riqi, Zname);
Printf(" \ t %-4d %-8s %-8s \ n ",Zheng Hao, Ziming, Riqi, Zname);
}
fclose(FP);
Printf ("\ t \ t \ t \ tPress any key to return \ n");
getch(); //Return
Relieve summer heat and relieve pain ();
}