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-7-bit X-Google-Thread: 103376,a7bbb0afe417ddd2 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Need Help.. Date: 1997/11/01 Message-ID: #1/1 X-Deja-AN: 286520519 References: <345346AB.77C4@upnaway.com> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-11-01T00:00:00+00:00 List-Id: In article <345346AB.77C4@upnaway.com>, sho@upnaway.com wrote: >I have encountered a difficult task in programming with Ada,the task of >this program is to get user input for an exression such as: >(X+y)/(a+b) >then it will check for any errors,when there is no error.The program >should ask the user for an input to define X,y,a,b then evaluate the >values.It might seems simple but for me it isnt:(,If any of you have >done the same program or anything similar to that or even some bits that >will give me a clue on how to do it.Please email me or write on the >board.I would like to thank you for your time and consideration:) procedure P is procedure Get (Prompt : in String; Value : out Integer) is begin Main: loop Ada.Text_IO.Put ("Enter " & Prompt & ": "); begin Ada.Integer_Text_IO.Get (Value); exit Main; exception when Ada.Text_IO.Data_Error => Ada.Text_IO.Skip_Line; Ada.Text_IO.Put ("Bad value; try again: "); end; end loop Main; end Get; X, Y, A, B : Integer; begin Get ("X", X); Get ("Y", Y); Get ("A", A); Get ("B", B); exception when Ada.Text_IO.End_Error => null; end; Will that do what you want? -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271