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=-2.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,PP_MIME_FAKE_ASCII_TEXT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,1829baf3f3969656 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-25 20:56:05 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!enst!enst.fr!not-for-mail From: Wilhelm.Spickermann@t-online.de (Wilhelm Spickermann) Newsgroups: comp.lang.ada Subject: RE: Converting Binary to Decimal Date: Mon, 26 Mar 2001 06:51:47 +0200 (CEST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 985582460 37624 137.194.161.2 (26 Mar 2001 04:54:20 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 26 Mar 2001 04:54:20 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Mailer: XFMail 1.4.0 on Linux X-Priority: 3 (Normal) In-Reply-To: <99lofd$19j37@tech.port.ac.uk> X-Sender: 0211750756-0001@t-dialin.net Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.3 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: supernews.google.com comp.lang.ada:6043 Date: 2001-03-26T06:51:47+02:00 On 25-Mar-01 WM wrote: > I am writing a program like this: ... > subtype Binary_Number is Integer range 0..1; --define data type ... > function Bin_To_Dec(bin:Binary_Number) return Integer is ... > Answer := Answer + a_bin_num(Bin(J))*(2**(J-1)); ... > It gives me a lot of errors... really don't know what's wrong... > Please give some hints, thanks! The first error message I get points to Line 16, Character 39 and says: "array type required in indexed component". The "indexed component" is "Bin(J)". "Bin" is not an array, it�s an integer (0 or 1). The poor naming is the reason of the problems: Rename every occurrence of "Binary_Number" to "Binary_Digit_Type" and every occurrence of A_Bin_Num to "Binary_Number_Type" and then look at the function declaration: Did You really want what is written there? Wilhelm