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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6401d8e669ccd293,start X-Google-Attributes: gid103376,public From: jordan Subject: How can i print the element poped from a generic STACK Date: 2000/11/07 Message-ID: <3A0806E8.B72D569@hotmail.com>#1/1 X-Deja-AN: 690796859 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-11-07T00:00:00+00:00 List-Id: Dear all, i want to ask that how can i print the element poped from a generic STACK. i have write the following code: ===================================================== with TEXT_IO; use TEXT_IO; procedure sample is generic SIZE : POSITIVE; type ITEM is private; package STACK is procedure PUSH(E : in ITEM); procedure POP (E : out ITEM); end STACK; package body STACK is type TABLE is array (POSITIVE range <>) of ITEM; SPACE : TABLE(1..SIZE); INDEX : NATURAL := 0; procedure PUSH(E : in ITEM) is begin INDEX := INDEX + 1; SPACE(INDEX) := E; end PUSH; procedure POP(E : out ITEM) is begin E := SPACE(INDEX); INDEX := INDEX - 1; end POP; end STACK; package stackOfInt is new STACK(100, INTEGER); use stackOfInt; package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER); use INT_IO; i : Integer; begin stackOfInt.push(20); Put(stackOfInt.pop(i)); <------------- error!!! end sample; ============================================== i want to print the element of integer 20 on the screen, how can i do?? is my implementation wrong???