martes, diciembre 05, 2006

TRABAJO REALIZADO POR ALUMNO CLARETIANO - TRUJILLO

program eje;
uses crt;
(*Creado por: Renzo Cáceres Seminario
Fecha: 25/11/2006
Colegio: Claretiano – Trujillo
Grado y Nivel: 4to. De Secundaria*)
type fecha=record
d,m:integer;
end;
libros=record
cod:string[5];
tit,aut,edi:string[20];
est:string[1];
ano:integer;
fec:fecha;
end;
var libro:array[1..10] of libros;
a,b,f,i,j,sw,lon,pos:integer;
op,r:char;
aux,xtra:string;
procedure menu;
begin
gotoxy(15,3);writeln('MENU');
gotoxy(5,5);writeln('------------------------');
gotoxy(8,8);writeln('[1] Ingresos');
gotoxy(8,10);writeln('[2] Movimientos');
gotoxy(8,12);writeln('[3] Disponibilidad');
gotoxy(8,14);writeln('[4] Listado');
gotoxy(8,16);writeln('[5] Fin');
gotoxy(5,19);writeln('------------------------');
repeat
gotoxy(15,21);write('Ingrese opcion: ');
op:=readkey;
until op in ['1'..'5'];
write(op);
delay(300);
end;
begin
i:=0;
repeat
clrscr;
menu;
case op of
'1': begin
repeat
clrscr;
gotoxy(15,3);write('INGRESOS');
gotoxy(7,5);write('-------------------------');
gotoxy(8,8);write(' Numero de Registro : ',i+1);
repeat
gotoxy(8,10);write(' Codigo del Libro : ');readln(xtra);
sw:=0;
if i=0 then
sw:=0;
for b:=1 to i do
if libro[b].cod=xtra then
sw:=1;
lon:=length(xtra);
until ((lon=5) or (lon=0)) and (sw=0);
if xtra<>'' then
begin
i:=i+1;
libro[i].cod:=xtra;
with libro[i] do
begin
repeat
gotoxy(8,12);write(' Nombre del Libro : ');readln(tit);
until length(tit)<=20;
repeat
gotoxy(8,14);write(' Autor del Libro : ');readln(aut);
until length(aut)<=20;
repeat
gotoxy(8,16);write(' Editorial : ');readln(edi);
until length(edi)<=20;
repeat
gotoxy(8,18);write(' A¤o de Edicion : ');readln(ano);
until ano>1990;
est:='L';
end;
end;
a:=i;
until xtra='';
end;
'2': begin
repeat
for i:=1 to a do begin
begin
with libro[i] do
begin
clrscr;
gotoxy(15,3);write('MOVIMIENTOS');
gotoxy(5,5);write('-----------------------------');
gotoxy(8,8);write('Codigo del Libro : ');readln(aux);
if cod=aux then
begin
gotoxy(8,10);write('Titulo del Libro : ',tit);
gotoxy(8,12);write('Autor del Libro : ',aut);
gotoxy(8,14);write('Estado [S,D,L] : L');
gotoxy(8,16);write('Fecha de Devolucion');
repeat
gotoxy(11,18);write('Dia : ');readln(fec.d);
until (fec.d>0) and (fec.d<32);
repeat
gotoxy(11,20);write('Mes : ');readln(fec.m);
until (fec.m>0) and (fec.m<13);
end
else
begin
gotoxy(8,16);write('CODIGO NO ENCONTRADO');
end;
repeat
gotoxy(5,23);writeln('-----------------------------');
gotoxy(11,25);write('Otro Movimiento [S/N] : ');r:=readkey;
r:=upcase(r);
until (r='N') or (r='S');
write(r);
delay(300);
end;
end;
end;
until r='N';
end;
'3': begin
repeat
clrscr;
gotoxy(15,3);write('DISPONIBILIDAD');
gotoxy(5,5);write('-----------------------------');
gotoxy(8,8);write('Codigo del Libro : ');readln(xtra);
sw:=0;
for j:=1 to a do
begin
if libro[j].cod=xtra then
begin
sw:=1;
pos:=a;
end;
end;
if sw=0 then
begin
gotoxy(8,13);write('CODIGO NO ENCONTRADO');
end
else
begin
with libro[pos] do
begin
gotoxy(8,10);write('Titulo del Libro : ',tit);
gotoxy(8,12);write('Autor del Libro : ',aut);
gotoxy(8,14);write('Estado : ',est);
gotoxy(8,16);write('Fecha de Devolucion : ',fec.d,'/',fec.m);
end;
end;
repeat
gotoxy(5,18);writeln('-----------------------------');
gotoxy(11,20);write('Otro Consulta [S/N]: ');r:=readkey;
r:=upcase(r);
until (r='N') or (r='S');
write(r);
delay(300);
until r='N';
end;
'4': begin
clrscr;
gotoxy(23,3);write('LISTADO');
gotoxy(2,5);write('-----------------------------------------------');
gotoxy(5,7);write('#');
gotoxy(9,7);write('Codigo del Libro');
gotoxy(30,7);write('Titulo del Libro');
f:=10;
for i:=1 to a do
begin
with libro[i] do
begin
gotoxy(5,f);write(i);
gotoxy(9,f);write(cod);
gotoxy(30,f);write(tit);
end;
inc(f,2);
end;
readkey;
end;
'5': exit;
end;
until op='5';
end.