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-Thread: a07f3367d7,caabf5265fad78e5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 29 Jun 2009 16:13:54 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: unsigned type References: <59O1m.404661$4m1.69194@bgtnsc05-news.ops.worldnet.att.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4a48cc23$0$31331$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 29 Jun 2009 16:13:55 CEST NNTP-Posting-Host: f6dcdea9.newsspool4.arcor-online.net X-Trace: DXC=TT0@@ndBdWjFXUDVUnEXQm4IUKP_O7VW]oga;9OJDO8_SKfNSZ1n^B98ijHXl5_81a86d X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6718 Date: 2009-06-29T16:13:55+02:00 List-Id: Rob Solomon schrieb: > I was able to use the Natural and Positive. > > Now I'm trying to understand Mod types. > > I tried this: > type card31 is mod 2_147_483_648; > type card32 is mod 4_294_967_296; > c31 : Card31; > c32: Card32; > LI : Long_Integer; > and > > LI := Long_Integer(c32); (this type conversion might not be what you want...) > How to I output c31 and c32? Modula-2 uses WriteCard or CardToString > and WriteString For the modular types you have defined, you instantiate I/O packages with the types. For example, with Ada.Text_IO; use Ada; -- make Text_IO directly visible procedure P is type card31 is mod 2_147_483_648; type card32 is mod 4_294_967_296; c31 : Card31; c32: Card32; LI : Long_Integer; -- I/O of modular numbers defined above package Card_IO_31 is new Text_IO.Modular_IO(card31); package Card_IO_32 is new Text_IO.Modular_IO(card32); begin Text_IO.put("c31 (not initialized) is "); Card_IO_31.Put(c31); Text_IO.new_line; Text_IO.put("c32 (not initialized) is "); Card_IO_32.Put(c32); Text_IO.new_line; end P; It's usually a good idea to have a tutorial or reference near you too look up such things.