主题:求助!
program chengji;
type student=record
num:integer;
name:array[1..15]of char;
sex:(male,female);
age:5..100;
score:real;
end;
studenta=array[1..10]of student;
srfile=file of student;
var
rfile,f1:student;
students:studenta;
stud:student;
i,j:integer;
ave1,ave2:real;
procedure print;
begin
writeln('num':2,'name':10,'sex':10,'age':5,'score':10);
while not eof(rfile) do
begin
read(rfile,i);
with stud do
begin
write(num:2,name:10);
if sex=male
then write('male':10)
else write('female':10);
write(age:5,score:10:1);
end;
writeln;
end;
end;
begin
assign(rfile,'rf.txt');
assign(f1,'f1.txt');
reset(rfile);
rewrite(f1);
for i:=1 to 10 do
read(rfile,c);
for i:=1 to 9 do
for j:=i+1 to 10 do
if students[i].score<students[j].score
then begin
stud:=students[i];
students[i]:=students[j];
students[j]:=stud;
end;
ave1:=(students[1].score+students[2].score+students[3].score)/3;
ave2:=(students[8].score+students[9].score+students[10].score)/3;
writeln('ave1=',ave1:0:2,' ','ave2=',ave2);
for i:=1 to 10 do
write(f1,c);
reset(f1);
print;
close(f1);
close(rfile);
end.
谁能给我说一说错在哪~
type student=record
num:integer;
name:array[1..15]of char;
sex:(male,female);
age:5..100;
score:real;
end;
studenta=array[1..10]of student;
srfile=file of student;
var
rfile,f1:student;
students:studenta;
stud:student;
i,j:integer;
ave1,ave2:real;
procedure print;
begin
writeln('num':2,'name':10,'sex':10,'age':5,'score':10);
while not eof(rfile) do
begin
read(rfile,i);
with stud do
begin
write(num:2,name:10);
if sex=male
then write('male':10)
else write('female':10);
write(age:5,score:10:1);
end;
writeln;
end;
end;
begin
assign(rfile,'rf.txt');
assign(f1,'f1.txt');
reset(rfile);
rewrite(f1);
for i:=1 to 10 do
read(rfile,c);
for i:=1 to 9 do
for j:=i+1 to 10 do
if students[i].score<students[j].score
then begin
stud:=students[i];
students[i]:=students[j];
students[j]:=stud;
end;
ave1:=(students[1].score+students[2].score+students[3].score)/3;
ave2:=(students[8].score+students[9].score+students[10].score)/3;
writeln('ave1=',ave1:0:2,' ','ave2=',ave2);
for i:=1 to 10 do
write(f1,c);
reset(f1);
print;
close(f1);
close(rfile);
end.
谁能给我说一说错在哪~