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

With the following program I want to end up with a file looking like
this:


                 {
                 {{"SMITH"},{{{"FRED"},62,75},{{"JACK"},55,57}}},
                 {{"JONES"},{{{"HARRY"},44,54},{{"SAM"},12,15}}}
                 }


   and NOT this:


        {
        {{83,77,73,84,72},{{{70,82,69,68},62,75},{{74,65,67,75},55,57}}},
        {{74,79,78,69,83},{{{72,65,82,82,89},45,54},{{83,65,77},12,15}}}
        }


   how do I go about changing this program to accomplish this ?
-------------------------------------------------------------------------------

include get.e
include wildcard.e
constant LAST_NAME=1,
     SAME_NAME=2, FIRST_NAME=1, LO=2, HI=3,
     SALARY={"", "\nBeginning Salary:", "\nEnding    Salary:"}
integer db_data
sequence record, data

function input_alpha()
     sequence input
     input=gets(0)
     input=input[1..length(input)-1]
     input=upper(input)
     puts(1,input)
     return input
end function

function input_num()
     object input
     atom number
     input=get(0)
     number=input[2]
     return number
end function

procedure create()
     db_data=open("data.dat","w")
     data={}
     puts(1,"\nHow many entries:")
     for number_of_entries=1 to input_num() do
          clear_screen()
          record=repeat(0,2)
          puts(1,"\nEnter Last Name:")
record[LAST_NAME]=upper(input_alpha())
          puts(1,"\nNumber of people with this last name:")
          record[SAME_NAME]=repeat({0,0,0},input_num())
          for loop=1 to length(record[SAME_NAME]) do
               puts(1,"\n\nFirst Name:")
               record[SAME_NAME][loop][FIRST_NAME]=input_alpha()
               for dollars=LO to HI do
                    puts(1,SALARY[dollars])
                    record[SAME_NAME][loop][dollars]=input_num()
               end for
          end for
          data=append(data,record)
     end for
     print(db_data,data)  close(db_data)
end procedure

create()

-------------------------------------------------------------------------------

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

Search



Quick Links

User menu

Not signed in.

Misc Menu