comp.lang.ada
 help / color / mirror / Atom feed
From: Wilhelm.Spickermann@t-online.de (Wilhelm Spickermann)
To: comp.lang.ada@ada.eu.org
Subject: RE: Converting Binary to Decimal
Date: Mon, 26 Mar 2001 06:51:47 +0200 (CEST)
Date: 2001-03-26T06:51:47+02:00	[thread overview]
Message-ID: <mailman.985582459.30913.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <99lofd$19j37@tech.port.ac.uk>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 845 bytes --]


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





  reply	other threads:[~2001-03-26  4:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-25 21:37 Converting Binary to Decimal WM
2001-03-26  4:51 ` Wilhelm Spickermann [this message]
2001-03-26 12:36 ` Des Walker
2001-03-26 20:57 ` Phaedrus
2001-03-28  8:15   ` Converting Binary to Decimal - holy war alert Martin Dowie
2001-03-28 18:43     ` Phaedrus
2001-03-29  7:31       ` Martin Dowie
2001-03-29 22:50         ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox