You are on page 1of 5

program proyecto1; uses crt; const max= 2; type arreglon=array [1..max] of string; arregloc=array [1..max] of real; arreglou=array [1..

max] of integer; arregloprom= array [1..max] of real; entero= integer; reales = real; var nombreyapellido:arreglon; cedula:arregloc; unidadesdecredito:arreglou; promedio:arregloprom; promedioseccion:real; posipromalto, posiprombajo:entero; supervisor, subsupervisor :string; procedure lectura ; var i,uc:entero; begin i:= 1; while i<=max do begin writeln ('introduzca el readln (nombreyapellido writeln ('introduzca la readln (cedula [i]); writeln ('introduzca el readln (promedio [i]);

nombre y el apellido'); [i]); cedula'); promedio');

writeln ('unidades de credito'); readln (unidadesdecredito[i]); if unidadesdecredito[i] < 5 then begin writeln ('el alumno no cumple con las unidades de credito asignadas'); readln; end else i:=i+1 end; end; function calcpromedioseccion (promedio:arregloprom): real; var i:entero; acum:real; begin acum:=0; for i:=1 to max do begin acum:=acum+promedio [i]; end; writeln('el promedio de la seccion es:' ,promedio[i]); readln; calcpromedioseccion:=acum/max;

end; function alumno_nota_mas_alta (promedio:arregloprom): integer; var posicion,i:entero; notamayor:real; begin notamayor:=0; for i:= 1 to max do begin if promedio[i]>notamayor then begin notamayor:=promedio[i]; posicion:=i; end; end; alumno_nota_mas_alta:=posicion; end; function alumno_nota_mas_baja (promedio:arregloprom): integer; var posicion,i:entero; notamenor:real; begin notamenor:=150; for i:= 1 to max do begin if promedio[i]>notamenor then begin notamenor:=promedio[i]; posicion:=i; end; end; alumno_nota_mas_baja:=posicion; end; procedure listado_alumnos_mayores_promedio(promedioseccion:real;nombreyapellido: arreglon;promedio:arregloprom); var i:entero; cont:entero; porcen:real; begin cont:=0; writeln ('los alumnos con la nota mayor son:' ); for i:= 1 to max do begin if promedio[i]>= promedioseccion then begin writeln ('nombre [i]',promedio[i]); readln; cont:=cont+1; end; end; porcen:=cont/max * 100; writeln ('el porcentaje de alumnos con mayor nota son:' ,porcen:2:2); readln; end; function cant_alumnos_menor_a_10 (promedio:arregloprom):integer;

var i,cont:entero; begin cont:=0; for i:=1 to max do if promedio [i]< 10 then cont:=cont+1; cant_alumnos_menor_a_10:=cont; end; procedure ordenarporunidades ( var nombreyapellido:arreglon; var cedula:arregloc; var unidadesdecredito:arreglou; var promedio:arregloprom); var i,j:entero; auxn:string; auxc:real; auxu:entero; auxp:real; begin for i:=1 to max - 1 do for j:=1 to max - 1 do if unidadesdecredito [j] < unidadesdecredito [j+1] then begin auxn:=nombreyapellido[j]; nombreyapellido[j]:= nombreyapellido[j+1]; nombreyapellido[j+1]:=auxn; auxc:=cedula[j]; cedula[j]:=cedula[j+1]; cedula[j+1]:=auxc; auxp:=promedio[j]; promedio[j]:=promedio[j+1]; promedio[j+1]:= auxp; auxu:=unidadesdecredito[j]; unidadesdecredito[j]:=unidadesdecredito[j+1]; unidadesdecredito[j+1]:=auxu; end; end; procedure buscarsupervisores (var supervisor,subsupervisor:string; var nombreyapellido:arreglon; var cedula:arregloc; var unidadesdecredito:arreglou; var promedio:arregloprom); begin ordenarporunidades (nombreyapellido,cedula,unidadesdecredito,promedio); supervisor:=nombreyapellido[1]; subsupervisor:=nombreyapellido[2]; end; function unidadesdecreditomayor ( unidadesdecredito:arreglou):integer; var posicion,i:entero; creditomayor:entero; begin creditomayor:=0; for i:= 1 to max do

begin if unidadesdecredito [i] > creditomayor then begin creditomayor:=unidadesdecredito[i]; posicion:=i; end; end; unidadesdecreditomayor:= posicion; end; function unidadesdecreditomenor ( unidadesdecredito:arreglou):integer; var posicion,i:entero; creditomenor:entero; begin creditomenor:=150; for i:= 1 to max do begin if unidadesdecredito [i] < creditomenor then begin creditomenor:=unidadesdecredito[i]; posicion:=i; end; end; unidadesdecreditomenor:= posicion; end; procedure mostrarsalidas(promedioseccion:real; posipromalto,posiprombajo:integer; supervisor,subsupervisor:string; nombreyapellido:arreglon); begin {writeln ('el alumno con la nota mas alta es:' , alumno_nota_mas_alta); readln; writeln ('el alumno con la nota mas baja es:' , alumno_nota_mas_baja); readln;} writeln ('el alumno con unidades de credito mayor es:' ,nombreyapellido[posiprom alto]); readln; writeln ('el alumno con unidades de credito menor son:' ,nombreyapellido[posipro mbajo]); readln; writeln ('cual es el supervisor:' , supervisor); readln; writeln ('cual es el subsupervisor:' , subsupervisor); readln; end; begin clrscr; lectura; promedioseccion:=calcpromedioseccion (promedio); listado_alumnos_mayores_promedio ( promedioseccion,nombreyapellido,promedio); posipromalto:=alumno_nota_mas_alta(promedio); posiprombajo:=alumno_nota_mas_baja(promedio); buscarsupervisores(supervisor,subsupervisor,nombreyapellido,cedula, unidadesdecredito,promedio); mostrarsalidas (promedioseccion,posipromalto,posiprombajo,supervisor,subsupervis or, nombreyapellido);

end.

You might also like