Код:
const
n=10;
type
session = array[1..10,1..5] of record
name: string;
mark: 2..5;
end;
student = record
fio: string;
curs: 1..5;
group: 1..9;
result:session;
formaobuch:char;
sum:Word;
end;
TFile= file of student ;
tmas=array [1..n] of student;
//--------------------------------------------------------
procedure vvodstudent(var st:student);
var
i,j:integer;
begin
with st do
begin
sum:=0;
write('Name: ');
readln(fio);
write('Course: ');
readln(curs);
write('Group: ');
readln(group);
writeln('Session results:');
for i:=1 to curs*2 do
begin
writeln('Session N',i,':');
for j:=1 to 5 do
begin
write('Subject of examination: ');
readln(result[i,j].name);
write('Mark: ');
readln(result[i,j].mark);
Inc(sum,result[i,j].mark);
end;
end;
write('Form of study: ');
readln(formaobuch);
end;
end;
//-------------------------------------------------------------------
procedure writestudent(var st:student);
var
i,j:integer;
begin
with st do
begin
writeln('Name: ',FIO,', Course: ',curs,' Group: ',group,' Form: ',formaobuch);
for i:=1 to curs*2 do
begin
writeln('Session ',i,': ');
for j:=1 to 4 do
write(result[i,j].name,': ',result[i,j].Mark,', ');
writeln(result[i,5].name,': ',result[i,5].Mark);
end;
end;
Writeln('Press "Enter" to continue...');
end;
var f1:Tfile;
rec,rec5:tmas;
q,p,N5:Byte;
Dummy:student;
begin
Assign(f1,'af.int');
rewrite(f1);
for q:=1 to n do
begin
vvodstudent(rec[q]);
Write(f1,rec[q]);
writeln;
end;
Close(f1);
writeln;
for q:=1 to n do
begin
writestudent(rec[q]);
readln;
end;
writeln;
N5:=0;
for q:=1 to n do
If rec[q].curs=5 then
begin
Inc(N5);
rec5[N5]:=rec[q];
end;
For p:=1 to N5-1 do
For q:=1 to N5-p do
if rec5[q].sum<rec5[q+1].sum then
begin
Dummy:=rec5[q];
rec5[q]:=rec5[q+1];
rec5[q+1]:=Dummy;
end;
Assign(f1,'af5.int');
rewrite(f1);
for q:=1 to N5 do
begin
writeln(rec5[q].fio:40,rec5[q].sum:4);
write(f1,rec5[q]);
end;
Close(f1);
readln;
end.
выделяет строчку выделенную красным и пишет type 'student' needs finalization-not allowed in file type