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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,22b2c05a8088bbb2 X-Google-Attributes: gid103376,public From: "Norman H. Cohen" Subject: Re: Leading zeros with Int_IO.Put()? Or another package? Date: 1996/11/08 Message-ID: <3283520E.1939@watson.ibm.com>#1/1 X-Deja-AN: 195297920 references: content-type: text/plain; charset=us-ascii organization: IBM Thomas J. Watson Research Center mime-version: 1.0 reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win95; I) Date: 1996-11-08T00:00:00+00:00 List-Id: Robert I. Eachus wrote: > ... 2) In Ada 95 look at Annex F. Good idea, this is certainly an appropriate application of picture-directed output. If your compiler supports the Information Systems annex, you can write: with Ada.Text_IO.Editing; use Ada.Text_IO, Ada.Text_IO.Editing; procedure Put_Time (Hours, Minutes, Seconds: in Integer) is type Time_Component_Type is delta 1.0 digits 2 range 0.0 .. 60.0; package Time_Component_Output is new Decimal_Output (Time_Component_Type); use Time_Component_Output; Leading_Zero : constant Picture := To_Picture ("99"); Leading_Space : constant Picture := To_Picture ("Z9"); begin Put (Time_Component_Type(Hours), Leading_Space); Put (':'); Put (Time_Component_Type(Minutes), Leading_Zero); Put (':'); Put (Time_Component_Type(Seconds), Leading_Zero); end Put_Time; -- Norman H. Cohen mailto:ncohen@watson.ibm.com http://www.research.ibm.com/people/n/ncohen