作业
qbasic吧
全部回复
仅看楼主
level 3
qbasic新手 楼主
9 8 7 6 5
10 21 20 19 4
11 22 25 18 3
12 23 24 17 2
13 14 15 16 1
2012年07月28日 07点07分 1
level 1
dim as integer x,y,s,n,i,j,p
dim as integer a(10,10)
cls
input n
for i=0 to n-1
for j=0 to n-1
a(i,j)=0
next j
next i
x=n-1
y=n-1
s=0
p=n*n
do while s<p
while a(x,y)=0 and x<n :s=s+1 :a(x,y)=s :x=x-1 :wend
x=x+1
y=y-1
while a(x,y)=0 and y>=0 :s=s+1 :a(x,y)=s :y=y-1 :wend
x=x+1
y=y+1
while a(x,y)=0 and x<n :s=s+1:a(x,y)=s :x=x+1 :wend
x=x-1
y=y+1
while a(x,y)=0 and y<n :s=s+1:a(x,y)=s :y=y+1 :wend
x=x-1
y=y-1
loop
print
for i=0 to n-1
for j=0 to n-1
print a(i,j);
next j
print
next i
sleep
一起 学习!!!
2012年08月01日 13点08分 2
level 3
qbasic新手 楼主
thank you
2012年09月16日 03点09分 3
level 8
2012年09月16日 22点09分 4
1