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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7d05ebe305483c33 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-25 04:32:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!freenix!enst!enst.fr!not-for-mail From: Michal Nowak Newsgroups: comp.lang.ada Subject: Re: Newbie question Date: Tue, 25 Dec 2001 13:36:13 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: 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: 7BIT X-Trace: avanie.enst.fr 1009283522 72333 137.194.161.2 (25 Dec 2001 12:32:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 25 Dec 2001 12:32:02 +0000 (UTC) To: "comp.lang.ada usegroup->mailing list gateway" Return-Path: In-reply-to: X-Mailer: Calypso Version 3.20.01.01 (3) Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk X-Reply-To: vinnie@inetia.pl List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:18292 Date: 2001-12-25T13:36:13+01:00 On 01-12-24 at 21:13 martin.m.dowie wrote: >"Michal Nowak" wrote in message >> Hour is of type Integer. It does not has to be predefined >> Integer. You may do something like this: >> type Hour_Type is range 0 .. 23; --this is declaration of >> --integer type >> Hour : Hour_Type; >> However, if you declare Hour_Type as a distinct type, you will >> have to cast result of Integer'Value to Hour_Type before assigning >> it to Hour: >> >> Hour := Hour_Type (Integer'Value ( >> Whole_Line(Current_Position .. Current'Position + >2) ) >> ); >> > >The bit about casting (in Ada usually called 'type converting') is a little >over the top as Hour_Type has access to the attribute 'Value too. Oh, in fact. My fault, my apologizes. So it >is a little simpler: > >Hour := > Hour_Type'Value (Whole_Line (Current_Position .. Current_Position + 2)); ^^^^ There was another little one. It should be Current_Position + 1 (assuming, that hour is two digit, and Current_Position is position of first digit). It looks that working with high temperature does not has good results. Getting back to bed now. Bye! Mike ----------------------------------------- ____| \%/ |~~\ O | o>> Mike Nowak | T | / > vinnie@inetia.pl | http://www.geocities.com/vinnie14pl _|__