Re: Help with seq's

new topic     » goto parent     » topic index » view thread      » older message » newer message

David,

Hopefully this example will clear things up a bit for you:

include get.e

sequence lname--,fname
sequence string1,string2,string3--,count3
integer index1, index2

lname = {
  -- [1][1]      [1][2]
  {"Testing 1 1","Testing 1 2"},
  -- [2][1]      [2][2]
  {"Testing 2 1","Testing 2 2"},
  -- [3][1]      [3][2]
  {"Testing 3 1","Testing 3 2"},
  -- [4][1]      [4][2]
  {"Testing 4 1","Testing 4 2"}}

clear_screen()
for q = 1 to length(lname) do
    puts(1,lname[q][1]&"\n")
    puts(1,lname[q][2]&"\n")
end for

puts( 1, "\n" )
index1 = prompt_number("Enter index 1 # > ",{1,length(lname)})
index2 = prompt_number("Enter index 2 # > ",{1,2})

puts( 1, "\n" )
puts( 1, lname[index1][index2]&"\n" )
printf( 1, "there are %d elements in sequence 'lname'\n\n", length(lname) )

--clear_screen()
-- Test to make a seq This is the Part that I need help with
string1 = prompt_string( "Enter a string > " )
string2 = prompt_string( "Enter another string > " )
string3 = {string1,string2}
--count3=prompt_number("enter a Number > ",{})

puts( 1, string3[1]&"\n" )
puts( 1, string3[2]&"\n\n" )

-- add string3 to lname
lname = append( lname, string3 )
-- display lname
for q = 1 to length(lname) do
    puts(1,lname[q][1]&"\n")
    puts(1,lname[q][2]&"\n")
end for

-- Brian

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu