Documentos de Académico
Documentos de Profesional
Documentos de Cultura
const
patoA = 550;
patoB = 430;
patoC = 620;
ingres = 500;
archi = 'Datospac.dat';
type
string12 = string[12]; {variable que se van a utilizar en la programación}
paciente = record
activo : boolean;
numpac : longint;
nombre : string[80];
apells : string;
edad : integer;
sexo : char;
patolg : char;
ingreso : real;
tiempo : integer;
fechent : string[12];
fechalt : string[12];
total : real;
end;
var
f : file of paciente;
datos : paciente;
ano, mes, dia, sem : word;
https://aprenderaprogramar.com/foros/index.php?topic=1075.0 1/5
3/4/22, 22:11 Pascal Ejemplo programa con menú, procedure, function, bucle for, repeat clinica
readln(apells);
write(' Entre Edad : ');
readln(edad);
write(' Entre Sexo [F/M] : ');
readln(sexo);
write(' Entre Patol. [A/B/C] : ');
readln(patolg);
ingreso := ingres;
fechent := diaingreso;
writeln;
writeln(' >>> Aceptar Datos [S/N] <<<');
repeat
tec := upcase(readkey);
until tec in['S','N'];
if tec = 'S' then
begin
if guardardatos(datos) = true then
writeln(' Datos De Paciente Guardados ')
else
writeln(' Error El Numero Paciente Existe No Guardado ');
writeln(' Pulse Una Tecla ');
end;
end;
end;
https://aprenderaprogramar.com/foros/index.php?topic=1075.0 2/5
3/4/22, 22:11 Pascal Ejemplo programa con menú, procedure, function, bucle for, repeat clinica
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
writeln(' Error Archivo No Encontrado Pulse Una Tecla');
readkey;
end
else
begin
for jh := 0 to filesize(f) - 1 do
begin
seek(f,jh);
read(f,mdi);
if mdi.numpac = num then
begin
term := true;
kk := jh;
mo := mdi;
break;
end;
end;
if term = true then
begin
if mdi.activo = true then
begin
term := false;
repeat
clrscr;
writeln(' ***** Menu Modificaciones *****');
writeln;
writeln(' P = Num. Paciente');
writeln(' N = Nombre');
writeln(' A = Apellidos');
writeln(' E = Edad');
writeln(' G = Patologia');
writeln(' F = Fecha Ingreso');
writeln(' S = Salir Y Guardar Cambios');
writeln;
writeln(' <<< Elija Opcion >>>');
repeat
deci := upcase(readkey);
until deci in['N','A','P','E','G','F','S'];
clrscr;
case deci of
'P' : begin
write(' Num. Paciente : ');
readln(mo.numpac);
end;
'N' : begin
write(' Nombre : ');
readln(mo.nombre);
end;
'A' : begin
write(' Apellidos : ');
readln(mo.apells);
end;
'E' : begin
write(' Edad : ');
readln(mo.edad);
end;
'G' : begin
write(' Patologia: ');
readln(mo.patolg);
end;
'F' : begin
write(' Fecha Ingreso : ');
readln(mo.fechent);
end;
'S' : begin
term := true;
end;
end;
until term = true;
mdi := mo;
seek(f,kk);
write(f,mdi);
end;
end;
close(f);
end;
end;
begin
clrscr;
menu;
end.
https://aprenderaprogramar.com/foros/index.php?topic=1075.0 5/5