Advertisement
Guest User

Untitled

a guest
Sep 26th, 2012
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.78 KB | None | 0 0
  1. program OtroProgra (input, output);
  2. type regis = record lega: string [8];
  3.                     brenom_ape: string [25];
  4.                     nota1, nota2: real;
  5.                     end;
  6. var
  7. index: integer;
  8. Alumno: array[1..50] of regis;
  9. Archi: file of regis;
  10. Promes: array[1..50] of real;
  11. alguPromo: boolean;
  12. cantiRecu, PromosIndex, LibresIndex: integer;
  13. Libres, Promos: array[1..50] of regis;
  14. BEGIN
  15. assign(Archi, 'C:/Win8/curso_mat.dat');
  16. reset(Archi);
  17. index:= 0;
  18. cantiRecu := 0;
  19. LibresIndex := 0;
  20. PromosIndex := 0;
  21.  
  22. While not EOF(Archi) do begin
  23.       index:= index + 1;
  24.       Read(Archi, Alumno[index]);
  25.       Promes[index] := (Alumno[index].nota1 + Alumno[index].nota2) / 2;
  26.       if Promes[index] >= 6 then begin
  27.          alguPromo := true;
  28.          PromosIndex := PromosIndex + 1;
  29.          Promos[PromosIndex]:= Alumno[index];
  30.       end;
  31.       else begin
  32.            if Promes[index] > 4 then cantiRecu:= cantiRecu + 1;
  33.            else begin
  34.                 LibresIndex := LibresIndex 1;
  35.                 Libres[LibresIndex] := Alumno[index];
  36.                 end;
  37.       end;
  38. end;
  39.  
  40. if alguPromo then begin
  41.    writeln('Legajo   Apellido y Nombre         Promedio');
  42.    writeln('-------- ------------------------- --------');
  43.    for i:=1 to PromosIndex do writeln(Promos[i].lega,' ',Promos[i].brenom_ape,' ',((Promos[i].nota1 + Promos[i].nota2) / 2):4:2);
  44. end;
  45. else writeln('No hay promovidos.');
  46. writeln('Alumnos que tienen que hacer el examen de recuperacion: ',cantiRecu);
  47. if LibresIndex > 0 then begin
  48.    writeln('Legajo   Apellido y Nombre         Nota1 Nota2');
  49.    writeln('-------- ------------------------- ----- -----');
  50.    for i:=1 to PromosIndex do writeln(Promos[i].lega,' ',Promos[i].brenom_ape,' ',Promos[i].nota1:4:2,'  ', Promos[i].nota2:4:2);
  51. end;
  52.  
  53. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement