![]() ![]() ![]() ![]() | Table Of Contents | Index |
Example:
var NumberArray,keywriteln "Array sequential on element 1"
loop 10 NumberArray[LoopIndex,1]=LoopIndex NumberArray[LoopIndex,2]=(random mod 50 + 1) writeln NumberArray[LoopIndex,1] " " NumberArray[LoopIndex,2] endloop ;the above creates a 2-dimensional array called NumberArray, ;where the first element is an array 1 through 10 and the ;second element is a set of random numbers
MatrixInvert NumberArray ;the coordinates of the 2-dimensional array are reversed
key = NumberArray[2] matrixinvert NumberArray ;the array is reinverted
SortArrayLinked NumberArray,key ;the array is sorted by key ;the array is now in order by the second element
writeln "Array now sorted based on element 2"
loop 10 writeln NumberArray[LoopIndex,1] " " NumberArray[LoopIndex,2] endloop
See Also: | MatrixInvert | SortArray |
---|
Category: | Array |
---|
![]() ![]() ![]() ![]() | Table Of Contents | Index |
|