Você está na página 1de 2

program try;

uses crt;
const maxturma=30;
stringlength=40;
numtestes=3;
type turmaindex=1..maxturma;
srtype=string[40];
notastestes=array[1..numtestes] of real;
rec_estudantes=record
nome,disciplina:srtype;
teste:notastestes;
media:real;
grau:string;{Inicialmente era de tipo char, feito pelo professor}
end;{record }
arrayestudantes=array[turmaindex]of rec_estudantes;
var turma:arrayestudantes;
a,b,e:integer;
c:rec_estudantes;
d:arrayestudantes;
procedure enterint (n,m:integer;var L :integer);
begin
repeat
write('de inteiro entre(N e M, i.e N<=M): ');
readln(L);
until (L>=N) and (L<=M);
end;{enterint}
procedure lerestudante(var est:rec_estudantes);
var i:integer;{md:real}
begin
with est do
begin
write('de o nome do estudante: ' );readln(nome);
write('de nome da disciplina: ' );readln(disciplina);
media:=0.0;
for i:=1 to numtestes do
begin
write('lendo teste',i:3 );readln(teste[i]);
media:=media+teste[i];
end;{for est}
media:=media/numtestes;
end;(* with *)
end;{lerestudante}
procedure lerturma(var T:arrayestudantes;var tam:integer);
var i:integer;
begin
writeln('lendo tamanho da turma(1..maxturma)!!'); enterint(1,maxturma,tam);
writeln('Introduzindo os dados de cada estudante!');
for i:=1 to tam do lerestudante(c);
end;{lerturma}
procedure pauta(var est:rec_estudantes);
begin
with est do
begin
writeln(nome:2);
write(',Sua Media e : ',media:2:1);
if media>=10 then grau:='APROVADO'else grau:='REPROVADO';
write(' : ',grau:5)
end;
end;
begin{main program}
clrscr;
lerturma(d,a);
pauta(c);
readln
end.

Você também pode gostar