Sistema de Gestión Turística
#Definir tamaño LEN de (estructura cliente)
#Contiene " string.h "
Estructura cliente
{
int num
char name[20];
Fecha larga
Estructura cliente * siguiente paso
} cus
Construir cliente *Crear (void)/*Crear una lista enlazada*/
{
Estructurar cliente *head, *p1, * p2
int n = 0;
p1=(estructura cliente*)malloc(LEN);
p2=(estructura cliente*)malloc(LEN) ;
Printf("Ingrese la información del cliente:\ n ");
printf(" \ n habitación:"); " ,&p 1->num);
printf("\n");
printf(" nombre:");
scanf(" % s ", p 1->; nombre);
printf(" \ n ");
Printf("Hora de entrada:");
scanf("%ld", &p 1->fecha);
printf("\n");
head = NULL
mientras( p 1->;num!=0)
{
n++;
si (n==1)
cabeza = p 1;
Otro
p2->; siguiente = p 1;
p2 = p 1
p1=(estructura Cliente *) malloc(LEN);
Printf("Ingrese la información del cliente: \ n "
printf(" \ n habitación:
< p); >scanf("%d",&p1->num);printf("\n");
printf(" nombre:");
p>
scanf("%s ", p 1->; nombre);
printf(" \ n "); :") ;
scanf("%ld ", &p 1->; fecha);
printf("\n");
}< /p >
p2->; next = NULL
Return (head);
}
struct cliente * insert(struct cliente * head, struct cliente * consumidor)/*Registrar información de nuevo cliente*/
{
Estructura cliente *p1, *p2
p 1 = encabezado;
p2 = consumidor;
if(p 1->;Siguiente! =nulo)
p 1 = p 1->; siguiente;
si (p 1->; siguiente==NULL)
{
p>
p 1->; siguiente = p2
p2->; siguiente = NULL
}
Retorno (cabeza) ;
}
struct customer * del(struct customer * head, int num)/*Mostrar información del cliente de pago*/
{
Estructura Cliente *p1, *p2
if(head==NULL)
{<
/p>
Printf("No hay información del cliente\ n ");
Devolver (encabezado);
}
p 1 =encabezado;
Y (num!= p 1->número&&p 1->siguiente!=null)
{
p2 = p 1 = p 1-; >; siguiente;
}
si(núm = = p 1->; número)
{
si(p1= =cabeza)
cabeza = p 1->; siguiente;
Otros
p2->; siguiente = p 1 -> Siguiente
Printf("Consultar información del cliente:\n");
Printf("Habitación: %d\n",&p 1-> ;num);
Printf ("nombre: %s\n ", p 1-& gt;nombre);
Printf("Hora de entrada: % ld \n ", &p 1->Fecha);
}
Otro
Printf("No hay información sobre este cliente\n");
Devolución (cabeza);
}
estructura cliente * búsqueda(estructura cliente * cabeza, char c _ nombre [])/*Consultar información del cliente*/ p>
{
Cliente de estructura * p;
p = encabezado
while(strcmp(p-& gt; nombre, c_name) andamp&p->next!=null)
p = p->next;
if (p->name==c_name)
{
Printf("La información del cliente es: \ n ");
Printf("Habitación: % d \Nombre: % s \Hora de registro: %ld ", p->num, p->nombre, p->fecha);
}
if (p->name!= c_name& amp&p->;next==NULL)
Printf("¡No hay información sobre este cliente!\ n ");
}
void Print(struct customer * head)/*Imprimir información del cliente*/
{
Estructura cliente * p;
printf("\nLa información del cliente existente es:\ n ");
p = cabeza
if (cabeza! = vacío)
Hacer
{
Printf("Habitación de invitados: %d\n ", p->num);
Printf ("nombre: %s\n ", p-& gt; nombre);
Printf ("Hora de registro: %ld\n ", p-& gt; fecha ); p>
Printf ("Hora de registro: %ld\n ", p-& gt; fecha);
p>p = p-& gt; } while(p!= NULL);
}
main()
{
Cliente de estructura *head, *p;
int m, número;
char c _ nombre[20];
printf(" \ n ");
Printf ("Producido por Chen Hongkai\ n \ n ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf("Bienvenido al sistema de gestión de información turística\ n ");
p>
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n \ n ");
Printf(" 1: Crear un base de datos \ n ");
printf(" 2:registro \ n ");
Printf(" 3:checkout\ n ");
printf (" 4:consulta \ n ");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n \ n ");
Printf("Por favor, haz algo:\ n ");
scanf("%d ", & ampm);
If (m==1)
head = creat();
Otros
If (m==2)
{
Printf("Ingrese la información del cliente para registrarse:");
p=(estructura cliente*)malloc(LEN);
scanf( " %d %s %ld",&p->num,p->nombre &p->fecha)
head=insert(head,p)
Imprimir(head);
}
Otro
if (m==3)
{
Printf("Por favor, introduzca el número de habitación donde el cliente realizó el check out:");
scanf("%d ", & number);
head=del(head, number) ;
Imprimir (cabeza);
}
Otros
Si (m==4)
{
Printf("Ingrese el nombre del cliente a consultar:");
scanf("%s ", c _ name
Buscar (head, c_name);
}
Otros
Printf("¡Error al ejecutar la operación!");
}
p>