El documento describe un programa para gestionar un videoclub. Define varios tipos de registros como persona, alumno y película. También define variables y archivos para almacenar esta información. A continuación, describe varios procedimientos como cuadro, print_carnet, nuevo y mod_socios para realizar funciones como mostrar cuadros, imprimir carnés de socio, agregar nuevos socios y modificar datos de socios existentes.
1. program Colegio;
uses crt,printer,dos;
type
persona = record
Nombre : string[15];
ap1 : string[15];
ap2 : string[15];
tel : string[9];
day : byte;
month : byte;
year : word;
Dir : string;
city : string;
prov : string;
end;
alumno = record
Nombre : string[15];
ape : string[15];
eda : string[15];
tel : string[9];
day : byte;
month : byte;
year : word;
Dir : string;
2. curs : string;
turn : string;
end;
tape = record
Titulo : string[35];
tipo : char;
socio : word;
estado : byte;
price : word;
multa : word;
day2 : word;
month2 : word;
year2 : word;
end;
var
archivo1 : file of persona;
archivo2 : file of tape;
archivo3 : file of alumno;
cliente : persona;
estuden : alumno;
movie : tape;
opcion : char;
3. a,b : byte;
dia : word;
mes : word;
ano : word;
dow : word;
car : word;
control : char;
day2p2 : byte;
monthaux : byte;
yearaux : word;
al : string;
n1 : Integer;
n2 : Integer;
n3 : Integer;
n4 : Integer;
n5 : Integer;
n6 : Integer;
acu : Integer;
prom : Real;
{*************************PROCEDURE
CUADRO**********************************}
procedure cuadro;
begin
textcolor (yellow);
gotoxy(25,6);
writeln ('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»');
gotoxy(25,7);
writeln ('º º');
9. writeln ('SelecionarOpci¢n');
normvideo;
gotoxy(27,20);
writeln ('A) Imprimir Carnet');
gotoxy(27,22);
writeln ('B) Corregir Datos');
gotoxy (45,24);
readln (opcion);
if upcase(opcion) = 'A' then
begin
write(archivo1,cliente);
close(Archivo1);
print_carnet;
end;
until upcase(opcion) = 'A'
end;
end;
{***************************PROCEDRUE
MOD_SOCIOS****************************}
procedure mod_socios;
begin
control:= 'b';
repeat
clrscr;
textcolor (white);
10. textbackground (blue);
writeln (' .: Tramitar :. ');
normvideo;
writeln;
writeln (' Digite Carnet: [ ]');
gotoxy(19,4);
textcolor (lightblue);
readln (car);
normvideo;
assign(archivo1,'clientes.dat');
reset(archivo1);
begin
while not eof(archivo1) do
begin
read(archivo1,cliente);
with cliente do
begin
if (car) = filepos(archivo1) then
begin
control := 'a';
gotoxy(3,6);
textcolor (yellow);
writeln (nombre,' ',ap1,' ',ap2);
normvideo;
gotoxy(3,8);
writeln ('Fecha de Afiliaci¢n: ');
11. if month < 10 then
begin
gotoxy(24,8);
textcolor (lightblue);
writeln ('[',day,'/0',month,'/',year,']');
normvideo;
end
else
begin
gotoxy(24,8);
textcolor (lightblue);
writeln ('[',day,'/',month,'/',year,']');
normvideo;
end;
gotoxy(3,10);
writeln ('Tel‚fono: ');
gotoxy(13,10);
writeln (tel);
gotoxy(3,12);
writeln ('Direcci¢n: ');
gotoxy(3,14);
writeln (dir,', ',city,', ',prov);
repeat
gotoxy(50,4);
textcolor (blue);
writeln ('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»');
gotoxy(50,5);
19. end;
end;
until upcase(opcion) = 'F'
end
end
end;
end;
until control= 'a';
end;
{****************************PROCEDURE PRINT_SOC****************************}
procedure print_soc;
begin
assign(archivo1,'clientes.dat');
reset(archivo1);
writeln (lst,' .: cat logo de clientes :.');
writeln
(lst,'**************************************************************************
***************');
writeln (lst,'Carnet Nombre');
writeln
(lst,'**************************************************************************
***************');
writeln (lst);
while not eof(archivo1) do
begin
20. read(Archivo1,cliente);
with cliente do
begin
car:= filepos(archivo1);
writeln (lst,car:4,' ',nombre,' ',ap1,' ',ap2);
end;
end;
end;
{****************************PROCEDURE CATA_SOC*****************************}
procedure cat_soc;
begin
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Cat logo de Socios :. ');
normvideo;
gotoxy(1,2);
textcolor (red);
textbackground (lightgray);
writeln (' Carnet Nombre ');
normvideo;
assign(archivo1,'clientes.dat');
reset(archivo1);
a:= 3;
while not eof(archivo1) do
begin
21. read(archivo1,cliente);
with cliente do
begin
a:= a+1;
car:= filepos(archivo1);
gotoxy(2,a);
writeln (car);
gotoxy(12,a);
writeln (nombre,' ',ap1,' ',ap2);
end;
end;
gotoxy(2,a+2);
writeln ('Desea Imprimir el cat logo de socios (s/n) [ ]');
gotoxy(46,a+2);
readln (opcion);
if upcase(opcion) = 'S' then
begin
print_soc;
clrscr;
gotoxy(30,12);
textcolor (white);
writeln ('Imprimiendo...');
delay(500);
normvideo;
end;
28. procedure mod_studen;
begin
control:= 'b';
repeat
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Tramitar :. ');
normvideo;
writeln;
writeln (' Digite Carnet: [ ]');
gotoxy(19,4);
textcolor (lightblue);
readln (car);
normvideo;
assign(Archivo3,'alumnos.dat');
reset(Archivo3);
begin
while not eof(Archivo3) do
begin
read(Archivo3,estuden);
with estuden do
begin
if (car) = filepos(Archivo3) then
begin
29. control := 'a';
gotoxy(3,6);
textcolor (yellow);
writeln (nombre,' ',ape,' ',eda);
normvideo;
gotoxy(3,8);
writeln ('Fecha de Afiliaci¢n: ');
if month < 10 then
begin
gotoxy(24,8);
textcolor (lightblue);
writeln ('[',day,'/0',month,'/',year,']');
normvideo;
end
else
begin
gotoxy(24,8);
textcolor (lightblue);
writeln ('[',day,'/',month,'/',year,']');
normvideo;
end;
gotoxy(3,10);
writeln ('Tel‚fono: ');
gotoxy(13,10);
writeln (tel);
gotoxy(3,12);
writeln ('Direcci¢n: ');
37. writeln (' ');
gotoxy(3,14);
writeln (' ');
gotoxy(3,14);
writeln (dir,', ',curs,', ',turn);
end;
end;
end;
end;
until upcase(opcion) = 'F'
end
end
end;
end;
until control= 'a';
end;
{****************************PROCEDURE print_alu****************************}
procedure print_alu;
begin
assign(Archivo3,'alumnos.dat');
reset(Archivo3);
writeln (lst,' .: cat logo de alumnos :.');
38. writeln
(lst,'**************************************************************************
***************');
writeln (lst,'Carnet Nombre');
writeln
(lst,'**************************************************************************
***************');
writeln (lst);
while not eof(Archivo3) do
begin
read(Archivo3,estuden);
with estuden do
begin
car:= filepos(Archivo3);
writeln (lst,car:4,' ',nombre,' ',ape,' ',eda);
end;
end;
end;
{****************************PROCEDURE CATA_SOC*****************************}
procedure cat_alu;
begin
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Cat logo de estudiantes :. ');
normvideo;
gotoxy(1,2);
textcolor (red);
39. textbackground (lightgray);
writeln (' Carnet Nombre ');
normvideo;
assign(Archivo3,'alumnos.dat');
reset(Archivo3);
a:= 3;
while not eof(Archivo3) do
begin
read(Archivo3,estuden);
with estuden do
begin
a:= a+1;
car:= filepos(Archivo3);
gotoxy(2,a);
writeln (car);
gotoxy(12,a);
writeln (nombre,' ',ape,' ',eda);
end;
end;
gotoxy(2,a+2);
writeln ('Desea Imprimir el cat logo de estudiantes (s/n) [ ]');
gotoxy(46,a+2);
readln (opcion);
if upcase(opcion) = 'S' then
begin
print_alu;
clrscr;
43. writeln (' Digite Carnet: [ ]');
gotoxy(19,4);
textcolor (lightblue);
readln (car);
normvideo;
assign(archivo1,'clientes.dat');
reset(archivo1);
begin
while not eof(archivo1) do
begin
read(archivo1,cliente);
with cliente do
begin
if (car) = filepos(archivo1) then
begin
control := 'a';
gotoxy(3,6);
textcolor (yellow);
writeln (nombre,' ',ap1,' ',ap2);
normvideo;
gotoxy(40,6);
writeln ('Fecha de Afiliaci¢n: ');
if month < 10 then
begin
gotoxy(61,6);
writeln ('[',day,'/0',month,'/',year,']');
45. writeln;
while not eof(archivo2) do
begin
read(archivo2,movie);
if movie.socio = filepos(archivo1) then
begin
if movie.month2 = 1 or 3 or 5 or 7 or 8 or 10 or 12 then
begin
day2p2 := movie.day2+2;
monthaux:= movie.month2;
if day2p2 > 31 then
begin
monthaux := month+1;
day2p2 := day2p2 - 31;
if monthaux > 12 then
begin
yearaux:= movie.year2+1;
monthaux := month-12;
end;
end;
end;
if movie.month2 = 4 or 6 or 9 or 11 then
begin
day2p2 := movie.day2+2;
monthaux:= movie.month2;
if day2p2 > 30 then
begin
46. monthaux := month+1;
day2p2 := day2p2 - 30;
if monthaux > 12 then
begin
yearaux:= movie.year2+1;
monthaux := month-12;
end;
end;
end;
if movie.month2 = 2 then
begin
day2p2 := movie.day2+2;
monthaux:= movie.month2;
if (movie.year2 mod 4) = 0 then
if day2p2 > 29 then
begin
monthaux := month+1;
day2p2 := day2p2 - 29;
if monthaux > 12 then
begin
yearaux:= movie.year2+1;
monthaux := month-12;
end;
end
else
begin
day2p2 := movie.day2+2;
47. monthaux:= movie.month2;
if day2p2 > 28 then
begin
monthaux := month+1;
day2p2 := day2p2 - 28;
if monthaux > 12 then
begin
yearaux:= movie.year2+1;
monthaux := month-12;
end;
end;
end;
end;
if monthaux < 10 then
begin
writeln(' ',filepos(archivo2),' '+
movie.titulo,movie.day2:21-
length(movie.titulo)+12,'/0',movie.month2,'/',movie.year2,+
' ',day2p2,'/0',monthaux,'/',yearaux);
end
else
begin
writeln(' ',filepos(archivo2),' '+
movie.titulo,movie.day2:21-
length(movie.titulo)+12,'/0',movie.month2,'/',movie.year2,+
' ',day2p2,'/',monthaux,'/',yearaux);
end;
end;
48. end;
normvideo;
readkey;
end
end
end;
end;
until control= 'a';
end;
{***************************************************}
{*************************NOTAS DE ALUMNOS********************************}
Procedure notas;
begin
control:= 'b';
repeat
clrscr;
49. begin
acu := 0;
WRITELN('DIGITE EL NOMBRE DEL ALUMNO: ');
READLN(al);
WRITE('MATEMATICAS: '); READLN(n1);
WRITE('BIOLOGIA: '); READLN(n2);
WRITE('HISTORIA: '); READLN(n3);
WRITE('CIVICA: '); READLN(n4);
WRITE('QUIMICA: '); READLN(n5);
WRITE('LENGUAJE: '); READLN(n6);
acu:=n1+n2+n3+n4+n5+n6;
prom:=acu/6;
WRITE('EL PROMEDIO DEL ALUMNO ES DE: '); WRITELN(prom:3:0);
READLN;
end;
until control= 'a';
end;
{*****************************************************}
{******************************PROCEDURE cons_materia************************}
procedure cons_materia;
begin
50. control:= 'b';
repeat
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Materias :. ');
normvideo;
writeln;
writeln (' Digite C¢digo: [ ]');
gotoxy(19,3);
textcolor (lightblue);
readln (car);
normvideo;
assign(archivo2,'mat.dad');
reset(archivo2);
begin
while not eof(archivo2) do
begin
read(archivo2,movie);
with movie do
begin
if (car) = filepos(archivo2) then
begin
control := 'a';
gotoxy(3,6);
textcolor (white);
51. writeln (titulo);
normvideo;
gotoxy(3,8);
writeln ('Nivel: [ ]');
case upcase(tipo) of
'A': begin
gotoxy(10,8);
textcolor(red);
writeln ('Primaria');
normvideo;
end;
'B': begin
gotoxy(10,8);
textcolor (lightblue);
writeln ('Intermedio');
normvideo;
end;
'C': begin
gotoxy(10,8);
textcolor (yellow);
writeln ('Secundaria');
normvideo;
end;
end;
gotoxy(3,10);
writeln ('Estado: ');
52. if estado = 0 then
begin
gotoxy(11,10);
textcolor (lightblue);
writeln ('Disponible');
normvideo;
gotoxy(3,12);
writeln ('Desea asiganar materia (s/n) [ ]');
gotoxy(37,12);
opcion := readkey;
case upcase(opcion) of
'S' : begin
gotoxy(3,14);
writeln ('Digite # de Carnet del docente [ ]');
gotoxy(33,14);
readln (dow);
socio:= dow;
estado:= 1;
getdate(ano,mes,dia,dow);
year2 := ano;
month2 := mes;
day2 := dia;
gotoxy(3,18);
writeln ('Registro Actualizado!');
writeln;
writeln (' Presione cualquier tecla para continuar...');
53. gotoxy(45,20);
readkey;
end;
end;
seek(archivo2,filepos(archivo2)-1);
write(archivo2,movie);
end
else
begin
gotoxy(11,10);
textcolor (red);
write ('Alquilada');
normvideo;
write (' por ');
assign(archivo1,'clientes.dat');
reset(Archivo1);
while not eof(Archivo1) do
begin
read(archivo1,cliente);
if socio = filepos(Archivo1) then
with cliente do
writeln (nombre,' ',ap1,' ',ap2);
end;
close(archivo1);
writeln;
if month2 < 10 then
54. begin
writeln (' Fecha: ', day2,'/0',month2,'/',year2);
writeln;
textcolor (red);
writeln (' Fecha de Devoluci¢n: ');
normvideo;
gotoxy(24,14);
writeln (day2+2,'/0',month2,'/',year2);
gotoxy(3,16);
writeln ('Devolver pel¡cula (s/n) [ ]');
gotoxy(28,16);
opcion := readkey;
case upcase(opcion) of
'S' :begin
estado:= 0;
socio := 0;
seek(archivo2,filepos(Archivo2)-1);
write(Archivo2,movie);
gotoxy(3,18);
writeln ('Registro Actualizado!');
writeln;
writeln (' Presione cualquier tecla para continuar...');
gotoxy(45,20);
readkey;
end;
end;
55. end
else
begin
writeln (' Fecha: ', day2,'/0',month2,'/',year2);
writeln;
textcolor (red);
writeln (' Fecha de Devoluci¢n: ');
normvideo;
gotoxy(24,14);
writeln (day2+2,'/',month2,'/',year2);
end;
end;
end;
end;
end;
end;
56. close(Archivo2);
gotoxy(3,18);
writeln ('Digite cualquier tecla para continuar...');
gotoxy(25,18);
until control= 'a';
end;
{*****************************PROCEDURE PLUS_CINTA**************************}
procedure plus_cinta;
begin
with movie do
begin
repeat
assign(archivo2,'mat.dad');
reset(archivo2);
seek(archivo2,filesize(archivo2));
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Asignar Materia a docente :. ');
normvideo;
gotoxy(3,4);
writeln ('Materia: [ ]');
gotoxy(3,6);
writeln ('C¢digo : [ ] Sueldo: [½ ]');
58. end;
end;
{********************************PROCEDURE
PRINT_INVENT**********************}
Procedure print_invent;
begin
assign(archivo2,'mat.dad');
reset(archivo2);
writeln (lst,' .: Inventario de Pel¡culas :.');
writeln
(lst,'**************************************************************************
***************');
writeln (lst,'C¢digo Materia Nivel Sueldo');
writeln
(lst,'**************************************************************************
***************');
while not eof(archivo2) do
begin
read(Archivo2,movie);
with movie do
begin
car:= filepos(archivo2);
write (lst,car:4,' ',titulo);
case upcase(tipo) of
'A' : writeln (lst,'Primaria':35-length(titulo)+15,' ½',price);
'B' : writeln (lst,'Intermedio':35-length(titulo)+14,' ½',price);
59. 'C' : writeln (lst,'Secundaria':35-length(titulo)+16,' ½',price);
end;
end
end;
end;
{*****************************PROCEDURE INVENTARIO**************************}
Procedure inventario;
begin
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Inventario de Materias :. ');
normvideo;
gotoxy(1,2);
textcolor (red);
textbackground (lightgray);
writeln (' C¢digo Materia Nivel Estado ');
normvideo;
assign(archivo2,'mat.dad');
reset(archivo2);
a:= 3;
while not eof(archivo2) do
begin
60. read(archivo2,movie);
with movie do
begin
a:= a+1;
car:= filepos(archivo2);
gotoxy(2,a);
writeln (car);
gotoxy(12,a);
writeln (titulo);
case upcase(tipo) of
'A': begin
gotoxy(53,a);
textcolor(red);
writeln ('Primaria');
normvideo;
end;
'B': begin
gotoxy(53,a);
textcolor (lightblue);
writeln ('Intermedio');
normvideo;
end;
'C': begin
gotoxy(53,a);
textcolor (yellow);
writeln ('Secundaria');
normvideo;
61. end;
end;
case estado of
0 : begin
gotoxy(69,a);
textcolor(lightblue);
writeln ('Asignada');
normvideo;
end;
1 : begin
gotoxy(69,a);
textcolor(Red);
writeln ('Libre');
normvideo;
end;
end;
end;
end;
gotoxy(2,a+2);
writeln ('Desea Imprimir el inventario (s/n) [ ]');
gotoxy(38,a+2);
readln (opcion);
if upcase(opcion) = 'S' then
print_invent;
62. end;
{*************************PROCEDURE MODIFICAR CINTAS************************}
Procedure modificar_cinta;
begin
repeat
clrscr;
textcolor (white);
textbackground (blue);
writeln (' .: Modificar Asiganacion de Materia :. ');
normvideo;
gotoxy(3,4);
writeln ('Digite C¢digo: [ ]');
gotoxy(19,4);
textcolor (lightblue);
readln (car);
normvideo;
assign(archivo2,'mat.dad');
reset(archivo2);
begin
while not eof(archivo2) do
begin
read(archivo2,movie);
with movie do
63. begin
if (car) = filepos(archivo2) then
begin
control := 'a';
gotoxy(3,6);
textcolor (white);
writeln (titulo);
normvideo;
gotoxy(3,8);
writeln ('Tipo: [ ]');
case upcase(tipo) of
'A': begin
gotoxy(10,8);
textcolor(red);
writeln ('A');
gotoxy(13,8);
writeln ('Primaria');
normvideo;
end;
'B': begin
gotoxy(10,8);
textcolor (lightblue);
writeln ('B');
gotoxy(13,8);
writeln ('Intermedio');
normvideo;
end;