home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMIGA PD 1
/
AMIGA-PD-1.iso
/
Programme_zum_Heft
/
Programmieren
/
Kurztests
/
ACE
/
Prgs
/
Misc
/
array_of_structs.b
next >
Wrap
Text File
|
1994-10-16
|
598b
|
34 lines
'..An example of how to have an array of structures.
DEFLNG a-z
CONST records=3
STRUCT myStructDef
STRING the_name
SHORTINT age
END STRUCT
DECLARE STRUCT myStructDef *myStruct
DIM myStructs(records)
'..read records
FOR i=1 TO records
PRINT
INPUT "Enter name: ",nm$
INPUT "Enter age: ",age
myStruct = ALLOC(SIZEOF(myStructDef))
IF myStruct = 0& THEN BEEP:STOP
myStruct->the_name = nm$
myStruct->age = age
myStructs(i) = myStruct
NEXT
'..show records
PRINT
FOR i=1 TO records
myStruct = myStructs(i)
PRINT "Name: ";myStruct->the_name;TAB(20);"Age: ";myStruct->age
NEXT