ESTE ES EL CODIGO FUE DE LOS QUE YO HIZE ESPERO QUE LE SIRVA
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
struct colas{
char clave[100],nc[100],nom[100];
double sueldo;
int tiquete;
struct colas *sig;
};
struct colas *read=NULL,*front=NULL;
void menu();
void dentrar();
void boletas();
void pasar();
void calculo();
main()
{
menu();
return 0;
}
void menu()
{
int n,esta,opcc;
for(int i=0;;i++)
{
clrscr();
esta=0;
gotoxy(20,2);
printf("BANCO DAVIVIENDA");
gotoxy(10,7);
printf("1. PASAR AL CLIENTE AL BANCO");
gotoxy(10,9);
printf("2. PASAR AL CAJERO ");
gotoxy(10,11);
printf("3. QUIT");
gotoxy(10,13);
printf("CUAL OPCION: ");
scanf("%d",&n);
switch
{
case 1:dentrar();break;
case 2
asar();break;
case 3:if(!front)
esta=1;
else
{
gotoxy(20,17);
printf("TODAVIA QUEDAN CLIENTE");
gotoxy(20,17);
printf("1. DESEA CONTINUAR DESPACHANDO QUEDAN CLIENTES");
gotoxy(20,18);
printf("2. CERRAR SOFTWARE");
gotoxy(20,20);
printf("OPCION: ");
scanf("%d",&opcc);
if(opcc==2)
esta=1;
}
break;
}
if(esta)break;
}
}
void dentrar()
{
char s;
int mirar;
struct colas *a,*b;
a=(struct colas*)malloc(sizeof(struct colas));
clrscr();
gotoxy(10,2);
printf("INFORMACION DEL CLIENTE");
gotoxy(10,5);
printf("NOMBRE: ");
gets(a->nom);
gets(a->nom);
gotoxy(10,7);
printf("CLAVE: ");
gets(a->clave);
b=read;
s='S';
do{
mirar=0;
gotoxy(10,9);
printf("NUMERO DE CUENTA: ");
gets(a->nc);
if(read)
{
while(b)
{
if(!(strcmp(b->nc,a->nc)))
{
gotoxy(20,22);
printf("YA EXISTE");
getch();
gotoxy(10,9);
printf(" ");
gotoxy(20,22);
printf(" ");
mirar=1;
break;
}
b=b->sig;
}
}
if(mirar==0)
s='N';
}while(s=='S');
gotoxy(10,11);
printf("SUELDO: ");
scanf("%lf",&a->sueldo);
gotoxy(10,17);
printf("NUMERO DE BOLETA: ");
scanf("%d",&a->tiquete);
if(!read)
{
a->sig=NULL;
read=front=a;
}
else
{
a->sig=read;
read=a;
}
return;
}
void pasar()
{
struct colas *q;
int bol,o;
if(front)
{
for(int i=0;;i++)
{
if(!front)break;
clrscr();
gotoxy(20,2);
printf("CAJERO DE SERVICIO");
gotoxy(10,6);
printf("1. SEGUIR");
gotoxy(10,7);
printf("2. CANCELAR");
gotoxy(10,8);
printf("OPCION: ");
scanf("%d",&o);
if(o==1)
{
gotoxy(10,10);
printf("NUMERO DE BOLETA AL SEGUIR [[ %d ]]",front->tiquete);
gotoxy(10,12);
printf("SU NUMERO DE BOLETA: ");
scanf("%d",&bol);
if(bol==front->tiquete)
calculo();
else
{
q=read;
while(q)
{
if(q->tiquete==bol)
{
gotoxy(20,20);
printf("LO SIENTO POR FAVOR HAGA LA FILA");
gotoxy(20,21);
printf("LA BOLETA QUE SIGUE ES %d",front->tiquete);
getch();
break;
}
q=q->sig;
}
if(!q)
{
gotoxy(20,20);
printf("LO SIENTO NO EXITE EL CLIENTE");
getch();
}
gotoxy(20,20);
printf(" ");
}
}
else
break;
}
}
else
{
gotoxy(10,22);
printf("NO HAY NINGUN CLIENTE");
getch();
gotoxy(10,22);
printf(" ");
}
return;
}
void calculo()
{
struct colas *d;
int opc,apro=0,c;
double re;
char cla[100],con;
clrscr();
gotoxy(20,2);
printf("EJECUTAR PROCESO");
gotoxy(10,6);
printf("SALDO DEL CLIENTE %s ES %.0lf",front->nom,front->sueldo);
gotoxy(10,10);
printf("1. RETIRAR");
gotoxy(10,12);
printf("2. CONSIGNAR");
gotoxy(10,14);
printf("3. NADA");
gotoxy(10,16);
printf("OPCION DESEADA ");
scanf("%d",&opc);
gets(cla);
gotoxy(10,18);
printf("ANTE DE EJECUTAR LA OPERACION POR FAVOR");
c=3;
do{
gotoxy(10,19);
printf("CLAVE: ");
gets(cla);
if(!(strcmp(cla,front->clave)))
apro=1;
else
{
gotoxy(10,21);
printf("%d OPORTUNIDADES",c);
getch();
gotoxy(10,21);
printf(" ");
c--;
gotoxy(10,19);
printf(" ");
}
}while((c>=0)&&(!apro));
if(apro)
{
apro=0;
c=3;
do{
gotoxy(10,20);
printf("NUMERO DE CUENTA: ");
gets(cla);
if(!(strcmp(cla,front->nc)))
apro=1;
else
{
gotoxy(10,21);
printf("%d OPORTUNIDADES",c);
getch();
gotoxy(10,21);
printf(" ");
c--;
gotoxy(10,20);
printf(" ");
}
}while((c>=0)&&(!apro));
}
if(apro)
{
switch(opc)
{
case 1:while(1)
{
clrscr();
gotoxy(5,3);
printf("SALDO DEL CLIENTE %s ES %.0lf",front->nom,front->sueldo);
gotoxy(10,7);
printf("CUANTO DESEA RETIRAR: ");
scanf("%lf",&re);
if(re>front->sueldo)
{
gotoxy(10,20);
printf("NO SE PUEDE POR EL SUELDO QUE ES MENOR");
getch();
gotoxy(10,20);
printf(" ");
gotoxy(10,20);
printf("DESEA CONTINUAR <S><N> ");
con=getche();
if(toupper(con)=='N')break;
}
else
{
front->sueldo=front->sueldo-re;
break;
}
}
gotoxy(1,15);
printf("NUEVO SALDO DEL CLIENTE %s ES %.0lf",front->nom,front->sueldo);
getch();
break;
case 2:while(1)
{
clrscr();
gotoxy(5,3);
printf("SALDO DEL CLIENTE %s ES %.0lf",front->nom,front->sueldo);
gotoxy(10,7);
printf("CUANTO DESEA CONSIGNAR: ");
scanf("%lf",&re);
if(re<0)
{
gotoxy(10,20);
printf("NO EXISTE ESA CANTIDAD");
getch();
gotoxy(10,20);
printf(" ");
gotoxy(10,20);
printf("DESEA CONTINUAR <S><N> ");
con=getche();
if(toupper(con)=='N')break;
}
else
{
front->sueldo=front->sueldo+re;
break;
}
}
gotoxy(1,15);
printf("NUEVO SALDO DEL CLIENTE %s ES %.0lf",front->nom,front->sueldo);
getch();
break;
case 3: clrscr();
gotoxy(10,10);
printf("GRACIAS POR SU ATENCION");
getch();
break;
}
}
else
{
d=read;
while((d->sig!=front)&&(d!=front))
d=d->sig;
if(d==front)
{
gotoxy(5,22);
printf("LO SIENTO ACCESO DENEGADO POR NO CONSUIDIR CON LA INFORMACION");
gotoxy(5,23);
printf("COMO NO HAY MAS CLIENTES NO SE ATIENDE MAS");
getch();
gotoxy(5,22);
printf(" ");
gotoxy(5,23);
printf(" ");
}
else
{
gotoxy(5,22);
printf("LO SIENTO ACCESO DENEGADO POR NO CONSUIDIR CON LA INFORMACION");
gotoxy(5,23);
printf("POR FAVOR EL SIGUIENTE ES CON BOLETA %d",d->tiquete);
getch();
gotoxy(5,22);
printf(" ");
gotoxy(5,23);
printf(" ");
}
}
d=read;
while((d->sig!=front)&&(d!=front))
d=d->sig;
if(d==front)
front=read=NULL;
else
{
front=d;
d=front->sig;
front->sig=NULL;
}
free(d);
return;
}