B
This commit is contained in:
parent
e5e8880e41
commit
518da4a923
1019 changed files with 15877 additions and 0 deletions
29
Task/Arrays/BASIC256/arrays.basic256
Normal file
29
Task/Arrays/BASIC256/arrays.basic256
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# numeric array
|
||||
dim numbers(10)
|
||||
for t = 0 to 9
|
||||
numbers[t] = t + 1
|
||||
next t
|
||||
|
||||
# string array
|
||||
dim words$(10)
|
||||
# assigning an array with a list
|
||||
words$ = {"one","two","three","four","five","six","seven","eight","nine","ten"}
|
||||
|
||||
gosub display
|
||||
|
||||
# resize arrays (always preserves values if larger)
|
||||
redim numbers(11)
|
||||
redim words$(11)
|
||||
numbers[10] = 11
|
||||
words$[10] = "eleven"
|
||||
gosub display
|
||||
|
||||
end
|
||||
|
||||
display:
|
||||
# display arrays
|
||||
# using ? to get size of array
|
||||
for t = 0 to numbers[?]-1
|
||||
print numbers[t] + "=" + words$[t]
|
||||
next t
|
||||
return
|
||||
17
Task/Arrays/BBC-BASIC/arrays.bbc
Normal file
17
Task/Arrays/BBC-BASIC/arrays.bbc
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
REM Declare arrays, dimension is maximum index:
|
||||
DIM array(6), array%(6), array$(6)
|
||||
|
||||
REM Entire arrays may be assigned in one statement:
|
||||
array() = 0.1, 1.2, 2.3, 3.4, 4.5, 5.6, 6.7
|
||||
array%() = 0, 1, 2, 3, 4, 5, 6
|
||||
array$() = "Zero", "One", "Two", "Three", "Four", "Five", "Six"
|
||||
|
||||
REM Or individual elements may be assigned:
|
||||
array(2) = PI
|
||||
array%(3) = RND
|
||||
array$(4) = "Hello world!"
|
||||
|
||||
REM Print out sample array elements:
|
||||
PRINT array(2) TAB(16) array(3) TAB(32) array(4)
|
||||
PRINT array%(2) TAB(16) array%(3) TAB(32) array%(4)
|
||||
PRINT array$(2) TAB(16) array$(3) TAB(32) array$(4)
|
||||
24
Task/Arrays/Batch-File/arrays.bat
Normal file
24
Task/Arrays/Batch-File/arrays.bat
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
::arrays.cmd
|
||||
@echo off
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
set array.1=1
|
||||
set array.2=2
|
||||
set array.3=3
|
||||
set array.4=4
|
||||
for /L %%i in (1,1,4) do call :showit array.%%i !array.%%i!
|
||||
set c=-27
|
||||
call :mkarray marry 5 6 7 8
|
||||
for /L %%i in (-27,1,-24) do call :showit "marry^&%%i" !marry^&%%i!
|
||||
endlocal
|
||||
goto :eof
|
||||
|
||||
:mkarray
|
||||
set %1^&%c%=%2
|
||||
set /a c += 1
|
||||
shift /2
|
||||
if "%2" neq "" goto :mkarray
|
||||
goto :eof
|
||||
|
||||
:showit
|
||||
echo %1 = %2
|
||||
goto :eof
|
||||
Loading…
Add table
Add a link
Reference in a new issue