Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
37
Task/Loops-Nested/S-BASIC/loops-nested-2.basic
Normal file
37
Task/Loops-Nested/S-BASIC/loops-nested-2.basic
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
$constant ROWS = 10
|
||||
$constant COLUMNS = 10
|
||||
$constant TOPVAL = 20
|
||||
$constant TRUE = FFFFH
|
||||
$constant FALSE = 0H
|
||||
|
||||
var i, j, done = integer
|
||||
dim integer table(ROWS, COLUMNS)
|
||||
|
||||
rem - populate table using nested FOR..NEXT loops
|
||||
|
||||
for i=1 to ROWS
|
||||
for j=1 to COLUMNS
|
||||
table(i, j) = int(rnd(1) * TOPVAL) + 1
|
||||
next j
|
||||
next i
|
||||
|
||||
rem - show results using nested WHILE..DO loops
|
||||
|
||||
i = 1
|
||||
done = FALSE
|
||||
while i <= ROWS and not done do
|
||||
begin
|
||||
j = 1
|
||||
while j <= COLUMNS and not done do
|
||||
begin
|
||||
print using "## "; table(i, j);
|
||||
if table(i, j) = TOPVAL then done = TRUE
|
||||
j = j + 1
|
||||
end
|
||||
print
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
if i > ROWS then print "Target value of"; TOPVAL; " not found!"
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue