From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,bd0c95dbf4f2c5c2 X-Google-Attributes: gid103376,public From: Alejandro Villanueva <190921@cepsz.unizar.es> Subject: Re: How to write a list in Ada95??? Date: 2000/10/23 Message-ID: <39F47D19.18D570C0@cepsz.unizar.es>#1/1 X-Deja-AN: 684901522 Content-Transfer-Encoding: 8bit References: <39F2E8A3.563B3616@hotmail.com> <39F3004E.E9EF5FA5@worldnet.att.net> <39F30BCC.1BB47B7F@mailserv.cuhk.edu.hk> Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@news.unizar.es X-Trace: news.unizar.es 972325142 20387 155.210.154.31 (23 Oct 2000 18:19:02 GMT) Organization: Universidad de Zaragoza Mime-Version: 1.0 NNTP-Posting-Date: 23 Oct 2000 18:19:02 GMT Newsgroups: comp.lang.ada Date: 2000-10-23T18:19:02+00:00 List-Id: Excuse me again Robert, but I'll post some unchecked code here ;-) type Cell; type Cell_Ptr is access Cell; type Cell is record Number: Integer; Next: Cell_Ptr; end record; The_List: Cell_Ptr := new Cell; procedure Fill_The_List is My_List: Cell_Ptr := The_List; begin for I in 0 .. 20 loop My_List.Number := I; My_List.Next := new Cell; My_List := My_List.Next; end loop; end Fill_The_List; procedure Print_The_List is My_List: Cell_Ptr := The_List; begin while The_List.Next /= null loop Ada.Text_IO.Put_Line (Integer'Image (My_List.Number)); My_List := My_List.Next; end loop; end Print_The_List; Hope the code is right, but that's the idea ;-) klhui wrote: > sorry, as i have alreayd read the web page and see the example in the Gnat > compiler, i can't understand how can i print the list element........ > how can i get help??? > (i have define an integer list that has a pointer points to a record(The > record has an integer variables and a pointer to the next) > > James Rogers wrote: > > > kluhi, > > > > This looks a lot like a homework assignment. > > > > I will point you to some examples of linked lists in Ada. > > > > If you have access to the GNAT compiler, you will find an example > > of a linked list in its "examples" directory. > > > > If you have access to the web, you will find examples of linked > > lists in the "source" section of www.adapower.com. > > > > Jim Rogers > > Colorado Springs, Colorado > > > > klhui wrote: > > > > > > I am a new user, how can i write an integer list by using the access > > > type??? > > > And also how can i print the whole list???? > > > Thanks for reply -- ------------------------------------------------------ �Quieres Cobrar por Navegar en Internet? Visita: http://www.navegana.com/dinero/flintstone.html ------------------------------------------------------ Alejandro Villanueva 190921@cepsz.unizar.es ------------------------------------------------------