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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1829baf3f3969656 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-26 04:40:03 PST Message-ID: <3ABF37CD.3A01C20B@amsjv.com> Date: Mon, 26 Mar 2001 13:36:29 +0100 From: Des Walker Organization: Alenia-Marconi Systems X-Mailer: Mozilla 4.61 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Converting Binary to Decimal References: <99lofd$19j37@tech.port.ac.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: farwkn6911.frlngtn.gecm.com X-Trace: 26 Mar 2001 13:30:57 GMT, farwkn6911.frlngtn.gecm.com Path: supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!grolier!btnet-peer0!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!farwkn6911.frlngtn.gecm.com Xref: supernews.google.com comp.lang.ada:6045 Date: 2001-03-26T13:36:29+01:00 List-Id: Hi, this is not really an answer to your question, please disregard if it is not relevant. Have you considered reading your binary number as a string and using predefined attributes to convert it. e.g. with Ada.Text_Io; use Ada.Text_Io; procedure Convert_Test is Value_Str : String(1 .. 8); Last : Natural; Value_Int : Integer; begin Put_Line("input binary number please: "); Get_Line(Value_Str, Last); Value_Int := Integer'Value("2#" & Value_Str(1 .. Last) & '#'); Put_Line("Decimal is" & Integer'Image(Value_Int)); end Convert_Test; Admittedly if the user typed a bad digit, this version would produce a Constraint Error on the conversion, whereas yours would produce an error on the Get call. Des Walker Alenia-Marconi Systems