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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4de2579a53c3574f,start X-Google-Attributes: gid103376,public From: Doraiapp Subject: Help with my program Date: 1997/02/17 Message-ID: <3308B6FD.507C@fdusvrt1.fdu.edu>#1/1 X-Deja-AN: 219534373 Content-Type: text/plain; charset=us-ascii Organization: Fairleigh Dickinson University Mime-Version: 1.0 Reply-To: doraiapp@fdusvrt1.fdu.edu Newsgroups: comp.lang.ada X-Mailer: Mozilla 3.01Gold (Win16; I) Date: 1997-02-17T00:00:00+00:00 List-Id: I translated a code from java script to ada the code is as follows with text_io; use text_io; with stack; procedure calculator is package int_io is new integer_io(integer); package istack is new stack(integer); use int_io, istack; ch: character; done: exception; function getint(first_digit: character) return integer is n:integer :=0; ch: character :=first_digit; begin loop n :=n * 10 + character'pos(ch) - character'pos('0'); exit when end_of_line; get (ch); end loop; return n; end; procedure process_command(ch: character) is a, b: integer; begin case ch is when '0'..'9' => push(getint(ch)); when 'p' | 'P' => pop(a); put(a); new_line; when '-' => pop(a); put(b); push(b-a); when '+' => pop(a); put(b); pop(a); put(b); push(b+a); when 'q' |'Q' => raise done; when others=> put_line("bad command"); end case; exception when overflow => put_line("stack overflow"); when underflow => put_line("stack underflow"); end process_command; begin loop put(" > "); get(ch); process_command(ch); skip_line; end loop; exception when done => skip_line; end calculator; But my problem is it says b is never assigned a value and also i need to change the integer to a user defined one how do i achieve it? Thanking You Doraiapp PS please also reply at doraiapp@fdusvrt1.fdu.edu