home *** CD-ROM | disk | FTP | other *** search
- '..a linked list using ACE structures.
-
- deflng a-z
-
- struct node
- string nm
- address nxt
- end struct
-
- declare struct node *head,*new.item,*curr,*temp
-
- sub make.node
- make.node = Alloc(sizeof(node),2)
- end sub
-
- '..create head of list
- head = make.node
- if head = NULL then
- print "head node can't be allocated!"
- stop
- end if
-
- head->nm = ""
- head->nxt = NULL
- curr = head
-
- '..create list
- repeat
- input "type a name (or QUIT): ";x$
- new.item = make.node
- if new.item <> NULL then
- new.item->nm = x$
- new.item->nxt = NULL
-
- curr->nxt = new.item
- curr = curr->nxt
- else
- print "new node can't be allocated!"
- end if
- until ucase$(x$) = "QUIT" or new.item=NULL
-
- '..traverse list
- cls
- curr = head->nxt
- while curr <> NULL
- if ucase$(curr->nm) <> "QUIT" then print curr->nm
- curr = curr->nxt
- wend
-