主题:求助~~
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;
stfile=text of student;
var
rf,f1,f2:stfile;
students:studenta;
stud:student;
i,j:integer;
ave1:real;
procedure print(var f:stfile);
begin
writeln('num':4,'name':10,'sex':8,'age':3,'score':5);
while not eof(f) do
begin
read(f,stud);
with stud do
begin
write(num:4,name:10);
if sex=male then write('male':8)
else write('female':8);
write(age:3,score:5:1);
end;
writeln
end;
end;
begin
assign(rf,'rfile');
assign(f1,'chengji.txt');
reset(rf);
rewrite(f1);
while not eof(rf) do
while not eoln(rf) do
for i:=1 to 10 do
readln(rf,students[i]);
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[9].score+students[8].score+students[10].score)/3;
for I:=1to 10 do
writeln(f1,students[i]);
reset(f1);
print(f1);
close(rf);
close(f1)
end.
他说我是 100磁盘读错误
为什么~~~急啊
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;
stfile=text of student;
var
rf,f1,f2:stfile;
students:studenta;
stud:student;
i,j:integer;
ave1:real;
procedure print(var f:stfile);
begin
writeln('num':4,'name':10,'sex':8,'age':3,'score':5);
while not eof(f) do
begin
read(f,stud);
with stud do
begin
write(num:4,name:10);
if sex=male then write('male':8)
else write('female':8);
write(age:3,score:5:1);
end;
writeln
end;
end;
begin
assign(rf,'rfile');
assign(f1,'chengji.txt');
reset(rf);
rewrite(f1);
while not eof(rf) do
while not eoln(rf) do
for i:=1 to 10 do
readln(rf,students[i]);
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[9].score+students[8].score+students[10].score)/3;
for I:=1to 10 do
writeln(f1,students[i]);
reset(f1);
print(f1);
close(rf);
close(f1)
end.
他说我是 100磁盘读错误
为什么~~~急啊