Computer Science Canada

list selections

Author:  the_scott_mans [ Tue Apr 01, 2003 9:27 pm ]
Post subject:  list selections

I was just wondering if you had to do somthing special to listed like thing to be able to use the numbers as selections.

EX.

put "" : 14, "Electronics"
put "" : 14, "*************"
put ""
put ""
put "" : 14, "Xbox"
put "" : 14, "1.Games"
put "" : 14, "2.Controllers"
put ""
put ""
put "" : 14, "PS2"
put "" : 14, "3.Games"
put "" : 14, "4.Controller"

Author:  Tony [ Tue Apr 01, 2003 9:40 pm ]
Post subject: 

yes - arrays http://www.compsci.ca/bbs/viewtopic.php?t=366

in array, you can use a variable to get information from another variable without complex if statments. Just read the tutorial Wink

Author:  the_scott_mans [ Tue Apr 01, 2003 10:11 pm ]
Post subject: 

so what exactly would i do. I have 17 items listed in my program

would i put

var name : array 1..17 of int


%then put

for i : 1..17
put name (i)
end for

and what exactly would this do i sort of get it

Author:  Tony [ Tue Apr 01, 2003 10:18 pm ]
Post subject: 

well you input item names in there

name(1):=pen
name(2):=mouse
...

better to do it from an external file - we got a tutorial on that too Wink

then when making your selection, you just type the number:

put "pick"
get number

put "you picked ", name(number)

Author:  the_scott_mans [ Tue Apr 01, 2003 10:37 pm ]
Post subject: 

I don't quite understand. Where exactly do you put


name(1):=pen
name(2):=mouse

and where is this turtorial


: