关于写PASCAL蛇形矩阵的问题
你的y没付初值
for x :=1 to n do
for y := 1to n do
a[x,y]:=0;
k :=n; j:=1; tot :=0; x :=1;
这里因为y加入循环 循环末值为n
这就相当于y:=n=5
你的输出是1 to n 当然没输出
要把y付为0就可以了
-------------------------------------
注:程序风格要注意,for 和while最好要有缩进
帮你改了下
program shexingjuzhen;
var a : array[1。 。25,1。。25] of integer;
i,j,k,n,x,y,tot :inte...全部
你的y没付初值
for x :=1 to n do
for y := 1to n do
a[x,y]:=0;
k :=n; j:=1; tot :=0; x :=1;
这里因为y加入循环 循环末值为n
这就相当于y:=n=5
你的输出是1 to n 当然没输出
要把y付为0就可以了
-------------------------------------
注:程序风格要注意,for 和while最好要有缩进
帮你改了下
program shexingjuzhen;
var a : array[1。
。25,1。。25] of integer;
i,j,k,n,x,y,tot :integer;
begin
readln(n);
for x :=1 to n do
for y := 1to n do
a[x,y]:=0;
k :=n; j:=1; tot :=0; x :=1; y:=0;
while tot
多给我+点分吧
。收起