program fichaes;
uses
crt;
const
max = 40;
type
ficha = record
idn : longint;
nom : string[80];
ed : integer;
sex : char;
pro_sem : real;
end;
var
datos : array[1..max] of ficha;
cont : integer;
tec : char;
procedure entradaficha;
var
tec : char;
begin
clrscr;
writeln('**** Entrada Ficha Estudiante
****');
writeln;
cont := cont + 1;
if cont > max then
cont := max;
write(' Num. Identidad :
');
readln(datos[cont].idn);
write(' Nombre :
');
readln(datos[cont].nom);
write(' Edad :
');
readln(datos[cont].ed);
write(' Sexo [M]=maculino [F]=femenino :
');
repeat
tec := upcase(readkey);
until tec in['M','F'];
writeln(tec);
datos[cont].sex := tec;
write(' Promedio Semestre :
');
readln(datos[cont].pro_sem);
end;
procedure muestrafichas(cual : byte);
var
codi : longint;
t, v : integer;
no : boolean;
begin
codi := 0;
if cual > 0 then
begin
clrscr;
writeln('<<<< Entre Codigo Estudiante
>>>>');
writeln;
write(' Num. Codigo : ');
readln(codi);
if codi > 0 then
begin
no := true;
for v := 1 to cont do
begin
if datos[v].idn = codi then
begin
clrscr;
writeln('### Los Datos Pedidos Son
###');
writeln;
writeln(' Num. Idn. =
',datos[v].idn);
writeln(' Nombre =
',datos[v].nom);
writeln(' Edad =
',datos[v].ed);
writeln(' Sexo =
',datos[v].sex);
writeln(' Pro.Sem. =
',datos[v].pro_sem:0:2);
writeln;
writeln('<<< Pulse Una Tecla >>>');
readkey;
no := false;
break;
end;
end;
if no = true then
begin
writeln(',,, El Num. No Existe
,,,');
writeln('<<< Pulse Una Tecla >>>');
readkey;
end;
end;
end
else
begin
clrscr;
writeln(' Num. Idn. Nombre
Edad Sexo Pro.Sem.');
writeln;
for v := 1 to cont do
begin
writeln(' ',datos[v].idn,'
',datos[v].nom,' ',
datos[v].ed,' ',datos[v].sex,'
',datos[v].pro_sem:0:2);
if v > 24 then
begin
writeln;
writeln(' Pulse Una Tecla Para Segir
');
readkey;
clrscr;
writeln(' Num. Idn. Nombre
Edad Sexo Pro.Sem.');
writeln;
end;
end;
writeln;
writeln('<<< Pulse Una Tecla >>>');
readkey;
end;
end;
function mejor_promedio(mp : char) : string;
var
xz, v : integer;
pro : real;
begin
if cont > 0 then
begin
if upcase(mp) = 'M' then
begin
xz := 0;
pro := 0.0;
for v := 1 to cont do
if datos[v].pro_sem > pro then
begin
pro := datos[v].pro_sem;
xz := v;
end;
mejor_promedio := datos[xz].nom;
end;
if upcase(mp) = 'P' then
begin
xz := 0;
pro := 10.0;
for v := 1 to cont do
if datos[v].pro_sem < pro then
begin
pro := datos[v].pro_sem;
xz := v;
end;
mejor_promedio := datos[xz].nom;
end;
end
else
mejor_promedio := ' No Hay Valoraciones
Entradas';
end;
function notamedia_grupo : real;
var
me : real;
v : integer;
begin
me := 0.0;
if cont > 0 then
begin
for v := 1 to cont do
begin
me := me + datos[v].pro_sem;
end;
notamedia_grupo := me / cont;
end;
end;
procedure estudiantes4_4_5;
var
v : integer;
begin
for v := 1 to cont do
if (datos[v].pro_sem > 4) and
(datos[v].pro_sem < 4.5) then
begin
writeln(' Nombre ',datos[v].nom,' Nota
Media : ',datos[v].pro_sem);
end;
end;
function estudiantes_exentos : integer;
var
v, ex : integer;
begin
ex := 0;
estudiantes_exentos := 0;
if cont > 0 then
begin
for v := 1 to cont do
if datos[v].pro_sem > 4.7 then
ex := ex + 1;
estudiantes_exentos := ex;
end;
end;
procedure menu;
var
sal : boolean;
tecla : char;
begin
sal := false;
repeat
clrscr;
writeln(' ****** Menu Jeneral ******');
writeln;
writeln(' 1 = Entrada Nuevo Estudiante
');
writeln(' 2 = Presentar Todos Los
Estudiantes ');
writeln(' 3 = Presentar Estudiante Por
Num.Idn ');
writeln(' 4 = Mejor Promedio');
writeln(' 5 = Peor Promedio');
writeln(' 6 = Nota Media Del Grupo');
writeln(' 7 = Notas Comprendidas Entre
4/4.5 ');
writeln(' 8 = Estudiantes Nota Superior
a 4,7 ');
writeln(' 9 = Salir ');
writeln;
writeln(' <<<<< Elija Opcion >>>>>');
repeat
tecla := readkey;
until tecla
in['1','2','3','4','5','6','7','8','9'];
clrscr;
case tecla of
'1' : entradaficha;
'2' : muestrafichas(0);
'3' : muestrafichas(1);
'4' : begin
if cont > 0 then
writeln(' El Mejor Promedio Es :
',mejor_promedio('m'))
else
writeln(mejor_promedio('m'));
writeln;
writeln(' Pulse Una Tecla ');
readkey;
end;
'5' : begin
if cont > 0 then
writeln(' El Peor Promedio Es :
',mejor_promedio('p'))
else
writeln(mejor_promedio('p'));
writeln;
writeln(' Pulse Una Tecla ');
readkey;
end;
'6' : begin
if cont > 0 then
writeln(' Lanota Media Del Grupo Es :
',notamedia_grupo:0:2)
else
writeln(' No Hay Valoraciones
Entradas');
writeln;
writeln(' Pulse Una Tecla');
readkey;
end;
'7' : begin
if cont > 0 then
estudiantes4_4_5
else
writeln(' No Hay Valoraciones
Entradas');
writeln;
writeln(' Pulse Una Tecla');
readkey;
end;
'8' : begin
if cont > 0 then
writeln(' Nota Superiores a 4.7 :
',estudiantes_exentos)
else
writeln(' No Hay Valoraciones
Entradas');
writeln;
writeln(' Pulse Una Tecla');
readkey;
end;
'9' : sal := true;
end;
until sal = true;
end;
begin
cont := 0;
menu;
end.