I would like to sort variables, (integers), from low to high, but my coding does not work.
I figured that sort(array) would be an ideal method... but I don't think it accepts variables.
//
// Project: sorting problem
// Created: 23-03-12
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "sorting problem" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
a as integer:b as integer:c as integer:d as integer:e as integer
a = random(1,100)
b = random(1,100)
c = random(1,100)
d = random(1,100)
e = random(1,100)
type myType
ID as integer
name as integer
endtype
myArray as myType[5]
myArray[0].ID = 1 : myArray[0].name = a
myArray[1].ID = 2 : myArray[1].name = b
myArray[2].ID = 3 : myArray[2].name = c
myArray[3].ID = 4 : myArray[3].name = d
myArray[3].ID = 5 : myArray[3].name = e
myArray.sort() //********************
do
print( myArray[0].name)
print( myArray[1].name)
print( myArray[2].name)
print( myArray[3].name)
print( myArray[4].name)
Sync()
loop
Mark G.
Coding is bliss...
Sometimes