关于一个PASCAL程序错误的原因
帮助看下以下程序错在哪了感激不尽!!!programex54;varn:array[1..5,1..6]of1..100;i,j:1..6;procedureenter;...
帮助看下以下程序错在哪了
感激不尽!!!
program ex54;
var
n:array[1..5,1..6] of 1..100;
i,j:1..6;
procedure enter;
begin
fillchar(n,sizeof(n),0);
for i:=i to 5 do
n[i,1]:=i;
for i:=1 to 5 do
for j:=2 to 4 do
begin
read(n[i,j]);
writeln;
end;
for i:=1 to 5 do
for j:=2 to 4 do
n[i,5]:=n[i,5]+n[i,j];
end;
procedure minci;
var
a:array[1..5] of 1..100;
k,t:1..6;
begin
for i:=1 to 5 do
a[i]:=n[i,4];
for i:=1 to 4 do
k:=i;
for j:=i+1 to 5 do
if a[j]>a[k] then k:=j;
if i<>k then
begin
t:=a[i];
a[i]:=a[k];
a[k]:=t;
end;
for i:=1 to 5 do
for j:=1 to 5 do
if n[j,4]=a[i] then n[j,5]:=i;
end;
begin
enter;
minci;
for i:=1 to 5 do
begin
for j:=1 to 6 do
write(n[i,j]:5);
writeln;
end;
end.
PS:错误为201
这个程序的题目是输入5个同学的3科成绩,求总分和名次,并按学号输出。 展开
感激不尽!!!
program ex54;
var
n:array[1..5,1..6] of 1..100;
i,j:1..6;
procedure enter;
begin
fillchar(n,sizeof(n),0);
for i:=i to 5 do
n[i,1]:=i;
for i:=1 to 5 do
for j:=2 to 4 do
begin
read(n[i,j]);
writeln;
end;
for i:=1 to 5 do
for j:=2 to 4 do
n[i,5]:=n[i,5]+n[i,j];
end;
procedure minci;
var
a:array[1..5] of 1..100;
k,t:1..6;
begin
for i:=1 to 5 do
a[i]:=n[i,4];
for i:=1 to 4 do
k:=i;
for j:=i+1 to 5 do
if a[j]>a[k] then k:=j;
if i<>k then
begin
t:=a[i];
a[i]:=a[k];
a[k]:=t;
end;
for i:=1 to 5 do
for j:=1 to 5 do
if n[j,4]=a[i] then n[j,5]:=i;
end;
begin
enter;
minci;
for i:=1 to 5 do
begin
for j:=1 to 6 do
write(n[i,j]:5);
writeln;
end;
end.
PS:错误为201
这个程序的题目是输入5个同学的3科成绩,求总分和名次,并按学号输出。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询