April 30, 2024, 10:36:11 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Virtual Array

Started by aurelCB, September 11, 2010, 02:40:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aurelCB

September 11, 2010, 02:40:30 PM Last Edit: March 04, 2023, 02:39:17 AM by aurelCB
I

TexasPete

AUREL,  That was interesting. I am glad you posted it. I will study it further when I have the time.

Texas Pete

GWS

Well it's an interesting run-around Aurel ..  ;D .. but I think your working arrays are very real, and you need two of them to do the job  ..  :P

Here's the same thing worked directly with one dynamically sized array ..


DEF asize,y,run:INT
DEF w1:WINDOW

autodefine "off"

Window w1,0,0,500,450,@minbox,0,"Virtual Array",main
Setwindowcolor w1,rgb(220,220,230)

' set required array size including the zero element ..
asize = 10

' dynamic sizing ..
def a[asize]:int

' generate array values allowing for zero element ..
FOR n = 0 TO asize-1
a[n] = n + 2
NEXT n

GOSUB show_array

'--------------------------------------------------------
run=1
waituntil run=0
closewindow w1
end

'-------------------------------------------------------
Sub main
Select @class
Case @idclosewindow
run=0
Case @idcreate
Centerwindow w1
Endselect
Return
'------------------------------------------------------
SUB show_array

FOR n = 0 TO asize-1
y = y + 30
Move w1,10,y : PRINT w1,"a[" + str$(n) + "] = ", a[n]
NEXT n

RETURN


best wishes, :)

Graham

Tomorrow may be too late ..