Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
41
Task/Spiral-matrix/FutureBasic/spiral-matrix.basic
Normal file
41
Task/Spiral-matrix/FutureBasic/spiral-matrix.basic
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
void local fn SpiralMatrix( size as int )
|
||||
int t = 0, b = size - 1, l = 0, r = size - 1
|
||||
int value = 0, i, j
|
||||
|
||||
while ( t <= b && l <= r) {
|
||||
for i = l to r
|
||||
mda(t,i) = value++
|
||||
next
|
||||
t++
|
||||
|
||||
for i = t to b
|
||||
mda(i,r) = value++
|
||||
next
|
||||
r--
|
||||
|
||||
if ( t <= b )
|
||||
for i = r to l step -1
|
||||
mda(b,i) = value++
|
||||
next
|
||||
b--
|
||||
end if
|
||||
|
||||
if ( l <= r )
|
||||
for i = b to t step -1
|
||||
mda(i,l) = value++
|
||||
next
|
||||
l++
|
||||
end if
|
||||
wend
|
||||
|
||||
for i = 0 to size -1
|
||||
for j = 0 to size - 1
|
||||
printf @"%2d \b",mda_integer(i,j)
|
||||
next
|
||||
print
|
||||
next
|
||||
end fn
|
||||
|
||||
fn SpiralMatrix( 5 )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue