#Contiene "stdio.h"
#Contiene "stdlib.h"
#Contiene "conio.h" p> p>
#Contiene "string.h"
#Contiene "math.h"
#define LEN sizeof (biblioteca de estructura)
#define LEN1 sizeof (lector de estructura)
#Define NULL 0
Biblioteca de estructura // estructura de biblioteca
{int académico, xcl
Nombre del personaje[20], autor[20], editor[20];
Biblioteca de estructuras* siguiente
};
Lector de estructuras //Estructura del lector
{
Zheng Haojie;
Xiaer Ziming[20], Riqi[20], zname[20];
Lector de estructuras * next
};
Void mainmenu() //Muestra el menú principal.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^ _^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf (" \ t\t\t1.Información de la biblioteca\n\n");
Printf ("\t\t\t2.Sistema de préstamos\n\n");
Printf ("\ t \ t \ t 3. Salga del sistema\ n \ n ");
printf ("\ t \ t \ tPor favor presione la tecla para seleccionar y presione enter para confirmar\ n ") ; p>
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^ _ ^ ^_^ ^_^*");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Volver;
}
Menú nulo1( ) //Mostrar menú de información de la biblioteca.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^ _^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf (" \t\t\t1. Editar inventario\n\n");
Printf ("\t\t\t 2. Borrar inventario\n\n");
Printf ("\ t \ t \ t 3. Consulta de libro \ n \ n ");
Printf ("\ t \ t \ t 4.
Lista de inventario\n\n");
Printf("\t\t\t5. Volver al nivel anterior\n\n");
printf("\ t \t\tPor favor presione la tecla para seleccionar y presione enter para confirmar\n ");
printf("*^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_ ^ ^ _^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Return;
}
Void menu2() //Muestra el menú de consulta.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^ _^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf (" \ t\t\t1.Consulta ISBN\n\n");
Printf ("\t\t\t2.Consulta de título del libro\n\n");
Printf ("\ t \ t \ t 3. Consulta de autor \ n \ n ");
Printf ("\ t \ t \ t 4. Por consulta \ n \ n "); >
printf("\t\t\tPor favor presione la tecla para seleccionar y presione enter para confirmar\n");
printf("*^_^ ^_^ ^_^ ^_ ^ ^_ ^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
printf( " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * );
Retorno;
}
Void main()// función principal, llama a main1.
{ void main 1();
main 1() }
Función void main1()//main1
{ void TSG xx();//Estado de cuenta
anular pase de débito e intereses(); //Estado de cuenta
selección de caracteres;
menú principal();
scanf("%c ",& select);
Cambiar (seleccionar)//Selección de función
{ case ' 1 ':tsgxx(); ;
caso '2': Jieshu Xitong(); descanso
Caso "3": sistema ("cls"); \n\n\n\n\n\t\tAdiós...");printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ tBienvenido ¡Utilice este software! ! "); getch(); exit(0); system("cls");
}
}
Void tsgxx()//Información de la biblioteca función
{ void ts jinku();
void shanchu();
void chax unts();
p>
void xianshikucun(); //Declaración de función
selección de caracteres;
menu 1(); //Llamar a la función de menú
scanf( "%c ", & amp select);
scanf ("%c ", & amp select);
for(;;)
Cambiar ( Seleccionar)/ /Selección de función
{ case ' 1 ':tsjinku();
Caso '2': Shanchu(); ": chax unts(); romper;
caso ' 4 ': xianshikucun(); romper;
Caso "5": principal 1(); romper;
}
}
Int tjzs()//Función estadística de cantidad de texto
{ FILE * fp
int tshuhao= 0, txcl=0, n;
char tname[20]={'\0'}, tauthor[20]={'\0'}, tchuban[20]= { ' \ 0 ' };
fp=fopen("library.txt", "r"); //Abre el archivo
for(n = 0;! feof(FP); N++)//Leer archivos uno por uno
fscanf(fp, "%d %s %s %s %d", & chuhao, turnam, towser, chu class.
txcl);
n-;
fclose(FP); //Cerrar el archivo
Return (n); //Devuelve un número
}
int tjdzs()//Función estadística de cantidad de texto
{ FILE * fp
int Zheng Hao=0, n; p>
char Ziming[20]={'\0'}, Richi[20]={'\0'}, zname[20]= { ' \ 0 ' };
fp =fopen("reader.txt", "r");//Abre el archivo
for(n = 0;!feof(FP);N++)//Lee los archivos uno por uno p>
fscanf(fp, " %d %s %s %s ", & amp Zheng Hao & amp Zi Ming & amp empresas japonesas & ampzname
fclose(FP); Cerrar el archivo
Return (n); //Devolver número
}
Void tsjinku()//Función de entrada de biblioteca
{ ARCHIVO * fp
int shuhao=0, xcl=0, n = 0
nombre de char[20]={'\0'}, autor[20]={ '\0' }, chuban[20]= { ' \ 0 ' };
char hitkey
System("cls");
If ( (FP = fopen ("library.txt", "r")== null) //Abre el archivo de la biblioteca y créalo si no existe
{ fp=fopen("library.txt). ", "w");
fclose(FP);
}
fp=fopen("library.txt", "a");
printf (" \n \ n \ n \ n \ n \ n \ t \ tIngrese la información del libro en el siguiente formato: \ t \ t \ t \ tISBN, título del libro, número de libros ingresados por editor\ nPor favor ingrese: ");//Ingrese la información de la biblioteca en formato.
for(;Keystroke!=27;)//Entrada en bucle
{ if (n!=0 )
Printf("Por favor ingrese:");
scanf("%d%s%s%s%d ", & amp ISBN, nombre, autor, editorial, autor . xcl) ;
fprintf(fp, " %d %s %s %s %d\n ", erudito, nombre, autor, Chuban,
Printf( " Presione enter para continuar escribiendo, presione esc\n para finalizar escribiendo\ n ");
n++
hitkey = getch()
for( ; pulsación de tecla! =13.
y pulsaciones de teclas! =27;)
hitkey = getch();
}
fclose(FP);
printf(" \ n \ n \ n \ n \ n \ n \ t \ tGuardar correctamente, presione cualquier tecla para volver al nivel anterior ");
getch();
tsgxx(); //Volver al nivel anterior
}
Void shanchu()//Función eliminar información del libro
{ struct Library * head = NULL
Biblioteca de estructuras *p, *p1, *p2
int tshuhao=0, txcl=0, n=0, j, I;
char tname[20]= {' \0'}, tauthor[20]={'\0'}, tchuban[20]={'\0'}, TT nombre[20]= { ' \ 0 ' };
char hitkey
ARCHIVO * fp
If ((FP = fopen ("library.txt", "r")== null)//Abrir el archivo.
{ system(" cls ");
printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t¡El archivo de registro no existe! Presione cualquier tecla para regresar... ");
getch();
tsgxx();
}
Otros
{ system(" cls ");
printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ t \ tPor favor ingrese el título del libro desea eliminar:" ); //Ingrese el nombre del libro eliminado.
scanf("%s ", & ampTT name);
printf("\t\ tPresione enter para confirmar la eliminación, o presione esc\npara cancelar\ n ");
hitkey = getch();
for(;Keystroke!=13.&Keystroke!=27 ;)
hitkey = getch();
if (hitkey==27)
tsgxx();
fp=fopen ("library .txt "," r ");
for(j = 0;!feof(FP);)//Lee la información de la carpeta y cuenta el número.
{ j++;
fscanf(fp, " %d%s%s%s%d ", & chuhao, turnam, towser, chuban.txcl
}
fclose(FP);
fp=fopen("biblioteca.txt ", " r "); ;i<j;i++)
{ fscanf(fp, "%d%s%s%s%d", & chuhao, turnam, towser, Chuban.txcl);
Si (strcmp(ttname, tname))//Compare nombres y copie información con diferentes nombres en la lista vinculada.
{ n++;
If (n==1)//Crea una lista enlazada.
{ p1=p2=(biblioteca de estructura*)malloc(LEN);
head = p 1;
}
Otros
{ p2->; siguiente = p 1;
p2 = p 1;
p1=(biblioteca de estructura*)malloc(LEN); Crear una nueva lista de enlaces
}
p 1->; shuhao = tshuhao // Copiar ISBN
strcpy(p 1->; nombre, tname) ;//Copiar el título del libro
strcpy(p 1->;Autor, Tauser);//Copiar el nombre del autor
strcpy(p 1->;Chuban, tchu ban) ;//Copia editorial
p 1->;xcl = txcl//Número de copias
}
}
Si ( n==0)
{ head = NULL
}
Otros
{
p2-> ;siguiente = p 1;
p 1->;siguiente = NULL
fclose(FP);
}
}
fp=fopen("library.txt "," w ");//Borrar el archivo
fclose(FP);
fp= fopen("library .txt ", " a "); //Agrega el archivo
p = header;
for(;p!= NULL)//Sobrescribe el contenido de la lista enlazada en el archivo.
{
fprintf(fp, " %d %s %s %s %d \n ", p-& gt; Shu Hao, p-& gt; nombre, p ->autor,p->chuban,p->xcl);
p = p->siguiente;
}
fclose( FP); //Cerrar el archivo
System("cls");
printf(" \ n \ n \ n \ n \ n \ n \ n \t \tEliminado exitosamente\n \tPresione cualquier tecla para regresar al nivel anterior\n ");
getch(); //Volver al nivel anterior
tsgxx();
}
Void chaxunts()//función de consulta
{
ARCHIVO * fp
selección de caracteres; p>
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'}, nombre TT [20]= { ' \ 0 ' };
If ((FP = fopen ("library.txt", "r")== null)//Abrir el archivo.
{ system(" cls ");
printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ tEl archivo de registro es no existe! Presione cualquier tecla para regresar... ");
getch();
tsgxx();
}
l = tjzs(); //Obtener el número de archivos
menu 2(); //Llamar a la función de menú
scanf("%c ", & amp select) ; scanf(" %c ",& amp select); //Elige el método de consulta
if (choose=='5 ')
Return;
Elseif (Choose = ' 1')//Consulta ISBN
{ system(" cls ");
Printf("Ingrese el ISBN:");
scanf(" %d ",& ampttshuhao);
}
Otros
If (choose=='2')//Consulta de título p>
{ system(" cls ");
Printf("Ingrese un título:
scanf("%s ", nombre TT); /p>
}
Otros
If (choose=='3')//Consulta del autor
{ system(" cls ");
Printf("Ingrese el autor:");
scanf("%s ", autor TT);
}
Otros
If (choose=='4')//Presione consulta
{ system(" cls ");
Printf("Por favor ingrese el editor:");
scanf("%s ",ttchuban);
}
Sistema("cls");
for(I = 0 ;i<l;i++)
{ fscanf(fp, " %d%s%s%s%d ", & chuhao, turnam, towser, chuban.txcl); Leer información del archivo
if (ttshuhao==tshuhao||!strcmp(ttname,tname)||!strcmp(ttauthor,tauthor)||!Strcmp(ttchuban,tchuban))//Información de consulta de salida.
{
If (k==0)
{
printf(" \ t \ t \ t \ tResultados de la consulta: \ n \ n ");
printf(" \ tISBN, título del libro, autor editorial\ n ");
}
printf( " \ t %-4d %-8s %-8s %-4d \ n ",tshuhao,tname,tauthor,tchuban,txcl);
k++;
}
}
If (k==0)//Si la carpeta está vacía, no se generarán registros.
{ system(" cls ");
printf(" \ n \ n \ n \ n \ n \ n \ t \ t \ t¡No hay registros coincidentes!\n ")
getch();
tsgxx();
}
fclose(FP); getch(); //Regresar
tsgxx();
}
Void xianshikucun()//Información real del inventario
{
ARCHIVO * fp
int shuhao=0, xcl=0, n=0, i=0, j=0;
nombre de carácter[ 20] ={'\0'}, autor[20]={'\0'}, chuban[20]= { ' \ 0 ' };
If ((fp = fopen ("biblioteca .txt ", " r ") = = null) //Abre la carpeta.
{
System("cls");
printf(" \n \n\n\n\n\n\n\n\n\t\tEl archivo de registro no existe ");
}
n = tjzs() ;
If (n==0)
{ system(" cls ");
printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t¡Sin registro ");
}
fp=fopen("library.txt "," r "); p>
System("cls");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf(" \ t ISBN título del libro directorio de publicación del autor \ n "); >
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
for(I = 0;I<n;I++)//Información de salida
{
fscanf( fp, " % d%s%s%s%d ", & ISBN, nombre, autor, editorial, autor. xcl);
printf(" \ t %-4d %-8s %-8s %-4d \ n ", erudito, nombre, autor, Chuban, xcl);
}
fclose(FP);
printf("\t\t\t\tPresione cualquier tecla para regresar\n");
getch( ); //Regresar
tsgxx();
}
Void menu3() //Muestra el menú principal del sistema de préstamo.
{ system(" cls ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf("*^_^ ^_^ ^_^ ^_^ ^ _^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”);
Printf (" \t\t\t1. Registro de préstamo de libros\n\n");
Printf ("\t\t\t 2. Registro de devolución de libros\n\n");
Printf ("\ t \ t \ t 3. Verificar el estado del préstamo \ n \ n "
Printf ("\ t \ t \ t 4. Volver al nivel anterior\ n \); n " );
printf(" \ t \ t \ tPor favor presione la tecla para seleccionar y presione enter para confirmar \ n ");
printf("*^_^ ^ _^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^*”); p>
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
Retorno;
}
Nulo jieshuxitong()//Función del sistema de préstamo
{ void jieshuxitong() ;
void huanshu();
void duzheilang(); //Declaración de función
selección de caracteres;
menú 3() ;
scanf("%c ", & amp select);
scanf("%c ", & amp select); //Seleccionar función
for(;;)
Cambiar (seleccionar)//Llamar función
{ case '1 ': Shujie() break;
Caso '2':Huanshu(); ruptura;
caso '3':duzheilang(); ruptura;
Caso "4":principal 1(); p>
}
}
Void Shujie()//Función de préstamo
{
ARCHIVO *fp, * fp3
Biblioteca de estructuras * head = NULL
Biblioteca de estructuras *p, *p1, *p2
int tshuhao=0, txcl=0, I, loop, Zheng bueno=0, n=0, k=0, t=0, bandera = 0;
char tname[20]={'\0'}, tauthor[20]={'\0 ' }, tchuban[20]={'\0'}, ttname[20]={'\0'}, Ziming[20]={'\0'}, riqi[20]={'\0'} , zname[20]= { ' \ 0 ' };
tecla de pulsación de carácter = 0;
Sistema ("cls"); p>
If ((FP = fopen ("library.txt", "r")== null)//Abra el archivo de la biblioteca.
{
system("cls");
printf(" \n\n\n\n\n\n\n\n\n \t\t¡Biblioteca agotada! Presione cualquier tecla para salir ”);
getch();
Salir(0);
} p >
Otro
{
{
printf(" \ n \ n \ n \ n \ n \ n \ t \ tPor favor, introduzca un Nombre del libro: \ t \ t \ t \ tPor favor ingrese: "); //Ingrese el título del libro
scanf("%s ",zname);
k = tjzs( ) ; //Cuenta el número de documentos de la biblioteca estadística.
for(I = 0;I<k;I++)//Leer información de la biblioteca y almacenarla en la lista vinculada.
{
fscanf(fp, " %d%s%s%s%d ", & chuhao, turnam, towser, chuban.txcl
n++;
If (n==1)
{ p1=p2=(biblioteca de estructura*)malloc(LEN);
head = p 1 ;
}
Otro
{ p2->; siguiente = p 1;
p2 = p 1;
p1=(biblioteca de estructura*)malloc(LEN);//Crear una nueva lista enlazada
}
p 1->; shuhao = tshuhao//Copiar ISBN
strcpy(p 1->; nombre, tname); //Copiar título del libro
strcpy(p 1->; autor, Toser);/ /Copiar autor
strcpy(p 1->chuban,tchu ban); //Copiar editor
p 1->xcl = txcl //Copiar monto existente
}
Si (n==0)
head = NULL
Otro
{
p2->;siguiente = p 1;
p 1->;siguiente = NULL
fclose(FP);
} p>
}
}
p =head;
for(;p!= NULL)//leer lista enlazada
{
if (!(strcmp(p->Name,zname)))//)//mismo nombre
{ flag = 1; //la bandera es 1.
loop = p-> -& gt; Siguiente;
}
Si (flag & amp& amp(loop & gt0)//Hay un título del préstamo y la cantidad disponible es mayor que 0.
{ fp=fopen("library.txt ", " w ");
fclose(FP); >
fp=fopen("biblioteca.txt", "a"
p = cabeza
for(;p!= NULL)
{
fprintf(fp, " % d %s %s %s %d \n ",p-& gt; Shu Hao, p-& gt; nombre, p-& gt; autor , p-& gt; chuban, p-& gt;
p = p-& gt; ); // Sobrescribe el archivo con el contenido de la lista vinculada.
fclose(FP);}
If (flag & amp& amp(loop & gt0)//Hay un título de préstamo y el monto disponible es mayor que 0. p>
{
{
If ((fp3 = fopen ("reader.txt", "r")== null)//Crear una carpeta de lector.
{ fp3=fopen("reader.txt ", " w ");
fclose(fp3
}
fp3); =fopen( "reader.txt ", " a ");
}
{
{ si (n!=0)
printf ("\n\n\n\n\n\n\t\tIngrese la información del lector de tarjetas en el siguiente formato:\t\t\t\t\Número de identificación fecha de devolución nombre\nIngrese:" ); //Ingrese la información del lector
scanf("%d %s %s %s ", & amp Zheng Hao & amp Ziming[20], & ampRiqi[20], & ampzname[20] ) ;
fprintf(fp3, "%d %s %s %s \n", Zheng Hao & amp Ziming[20], & Riqi[20], & ampzname[20]) ;
fp=fopen("library.txt ", " w "); //Eliminar información del archivo de la biblioteca
fclose(FP);
fp= fopen("library) .txt", "a");//Agregar información nuevamente
p = header;
for(;p!= NULL)//Usar archivo de biblioteca Sobrescribir el contenido del lista enlazada
{
fprintf(fp, " %d %s %s %d \n ", p-& gt; Shu Hao, p-& gt; nombre, p-& gt; autor, p-& gt;
fclose(FP);
fclose(fp3);
Printf("¡Éxito! Presione cualquier tecla para regresar\ n ");
getch ();//Volver
Aliviar el dolor por calor();
}
}
Aliviar el dolor por calor();
}
Otros
Printf("¡Este libro ha sido prestado! ¡Presiona cualquier tecla para regresar! "); // De lo contrario, el libro de salida se ha conectado.
getch(); //Regresar
Aliviar el dolor del verano ();
}
}
Void huanshu()//Función de retorno
{FILE *fp, *fp3
lector de estructuras * head = NULL
Lector de estructuras *p, *p1, *p2
Biblioteca de estructuras *lhead 1 = NULL;
Biblioteca de estructuras *zp1, *lp1, *lp2
int tshuhao=0, txcl =0, I;
char tname[20]={'\0'}, tauthor[20]={'\0'}, tchuban[20]={'\0'}, TT nombre[20 ]= { ' \ 0 ' };
int ttzhenghao=0, tzhenghao = 0, n=0, k=0, t=0, bandera = 0;
char tmingzi [20]={'\0'}, triqi[20]={'\0'}, tzname[20]={'\0'}, ttz nombre[20]= { '\ 0' } ; p>
char hit key = 0;
system("cls");
{
If ((FP = fopen ( "reader. txt", "r")== null)//Si no hay ningún archivo lector, no se puede devolver el resultado.
{
System("cls"); p>
p>
printf("\n\n\n\n\n\n\n\n\n\t¡Sin prestatario! ¡Presione cualquier tecla para salir!");
getch() ;
Salir(0);
}
Otros
{
{
printf(" \ n \ n \ n \ n \ n \ n \ t \ tIngrese el número de identificación del lector y el título del libro: \ t \ t \ t \ t \Ingrese: "); /p>
scanf("%d %s ", & ampttzhenghao, ttz name); //Ingrese el número de la tarjeta de devolución y el título del libro
k = tjdzs(); cantidad de información de la carpeta del lector
for(I = 0;i<k;I++)//Leer información de la carpeta del lector
{
fscanf(fp, " %d %s%s%s\n ", & amptzhenghao, tmingzi, triqi, tz nombre);
if ((TT Zheng Hao = = tzeng Hao)& amp; & amp! Strcmp(ttzname, tzname))//Si el encabezado del número de certificado existe, márquelo como 1.
bandera = 1;
}
fclose(FP);
fp=fopen("reader.txt "," r); ");//Abrir el archivo del lector
if(flag)
{
for(I = 0;i<k;I++)//serán los archivos del lector copiado en una lista vinculada.
{
fscanf(fp, " %d%s%s%s\n ", & amptzhenghao, tmingzi, triqi, tz name // Leer información del archivo< / p>
If (!((TT Zheng Hao == tzeng Hao)& & amp!strcmp(ttzname, tzname)))
{ n++;
if (n ==1)
{ p 1 = p2 =(struct Reader *)malloc(l EN1); //Crea una nueva lista enlazada
head = p 1; >
}
Otro
{ p2->; siguiente = p 1;
p2 = p 1; =(lector de estructura*)malloc(EN1);//Crear una nueva lista enlazada
}
p 1->; /p>
strcpy(p 1->; Ziming, tmingzi); //Copiar nombre del lector
strcpy(p 1->; Riqi, Trich);//Copiar fecha
strcpy(p 1->;zname, tz name);//Copiar título del libro
}
}
If (n==0 )
head = NULL
Otro
{
p2->; siguiente = p 1;
p 1->; siguiente = NULL
fclose(FP);
}
fp=fopen("lector .txt ", " w "); // Borrar el archivo del lector
fclose(FP);
fp=fopen("reader.txt ", " a ");/ /Información adicional
p =head;
for(;p!= NULL)//Sobrescribe el contenido de la lista vinculada en el archivo del lector.
{
fprintf(fp, " %d %s %s %s \n ", p-& gt; Zheng Hao, p-& gt; Ziming, p- > ;Ziqi, p->zname);
p = p->Siguiente;
}
Gratis(p) ;
fclose(FP);
}
}
}
}
Si(bandera) //La marca es 1 al devolver el libro.
{
{
{printf("¡Presione Enter para confirmar la devolución del libro!");
for( ; haga clic en Tecla! =13 y pulsación de tecla =27;)
hitkey = getch();
if (hitkey==13)
Imprimir ( "¡Éxito! ¡Presione cualquier tecla para regresar!");
n = 0; flag = 0;
fp3=fopen("library.txt ", " r "); // Abrir el archivo de la biblioteca
k = tjzs(); //Obtener el número de archivos de la biblioteca
for(I = 0;I<k;I++)//Copiar el archivo de la biblioteca a la lista enlazada en el medio.
{
fscanf(fp3, " %d%s%s%s%d ", & chuhao, turnam, towser, chuban.
txcl); //Leer información
n++;
If (n==1)
{ lp1=lp2=(biblioteca de estructura*)malloc( LEN );//Crear una nueva lista de enlaces
lhead 1 = LP 1;
}
Otros
{ lp2-> ; next = LP 1;
lp2 = LP 1;
lp1=(biblioteca de estructura*)malloc(LEN);//Crear una nueva lista enlazada
}
LP 1->;shuhao = tshuhao//Copiar ISBN
strcpy(LP 1->;Name, tname);//Copiar título del libro
strcpy(LP 1->;Author,Touser);//Copiar autor
strcpy(LP 1->;Chuban,tchu ban);//Copiar editor
LP 1 ->xcl = txcl //Copiar importe existente
}
if (n==0)
{ lhead 1 = NULL
<; p>}Otro
{
lp2->; siguiente = LP 1;
LP 1- >;
fclose(fp3);
}
}
}
ZP 1 = lcabeza 1;
for(zp1!= NULL)
{
if (!(strcmp(ZP 1->Nombre,ttz nombre) ))//)// Mismo título encontrado.
++(ZP 1->xcl); //Agregar 1 al monto existente
ZP 1 = ZP 1-> /p>
fp3=fopen("library.txt ", " w ");//Borrar el archivo de la biblioteca
fclose(FP);
fp3= fopen( "library.txt", "a");//Información adicional
ZP 1 = lhead 1;
for(;zp1!= NULL)//Archivo de biblioteca Sobrescribe el contenido de la lista enlazada.
{
fprintf(fp3, " %d %s %s %s %d \n ", ZP 1-> Shu Hao, ZP 1-> nombre, ZP 1->Autor,ZP 1->chuban,ZP 1->xcl);//Introducir información
ZP 1 = ZP 1->Siguiente;
}
fclose(fp3);
getch(); // regresar
aliviar el dolor por calor (); >Otros
Printf("¡Esta información no existe! ¡Presiona cualquier tecla para regresar!");
getch(); //Regresar
Aliviar a Summer Pain ();
}
void duzheilang()//Muestra la función de préstamo de libros.
{
ARCHIVO * fp
int Zheng Hao=0, xcl=0, n=0, i=0, j=0;
char Ziming[20]={'\0'}, Richi[20]={'\0'}, zname[20]= { ' \ 0 ' };
Si ( (FP = fopen ("reader.txt", "r")== null)//Abra la carpeta del lector.
{
system("cls");
printf(" \n\n\n\n\n\n\n\n\n \t\t¡El archivo de registro no existe ");
}
n = tjdzs();
If (n==0) p >
{ system(" cls ");
printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t¡Sin registro!" );
}
fp=fopen("reader.txt", "r");
system("cls");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);
printf(" \ tReader nombre con número de certificado, fecha de devolución del libro, título del libro \n "). * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *); p>
for(I = 0;i<n;I++)//Información del archivo de salida
{
fscanf(fp, " %d%s%s%s \n ", & amp Zheng Hao, Zi Ming, Riqi, zname);
printf(" \ t %-4d %-8s %-8s \ n ", Zheng Hao, Zi Ming, Ri odd, zname );
}
fclose(FP);
printf("\t\t\t\tPresione cualquier tecla para regresar\n" ); /p>
getch(); // regresar
Aliviar el dolor del verano ();
}