Tutorial by Examples

Instances of Integer_IO have a settings variable Default_Width which the number of characters that each output number will take. with Ada.Text_IO; use Ada.Text_IO; procedure Print_Integer is subtype Count is Integer range -1_000_000 .. 1_000_000; package Count_IO is new Integer_IO ...
A settings variable Default_Base is set on the instance of Ada.Text_IO.Integer_IO; also, Default_Width is set so that output cannot have leading space. with Ada.Text_IO; use Ada.Text_IO; procedure Print_Hex is subtype Count is Integer range -1_000_000 .. 1_000_000; package Count_IO...
Ada.Text_IO.Editing offers formatting decimal fixed point values using “picture strings”. These describe output using “magical” characters for separators, currency signs, etc. with Ada.Text_IO.Editing; use Ada.Text_IO; procedure Print_Value is Max_Count : constant := 1_000_000; ...
Combine the instances of the _IO packages, use the right one with its numeric type. with Ada.Text_IO; use Ada.Text_IO; procedure Print_Inventory is type Fruit is (Banana, Orange, Pear); subtype Count is Integer range -1_000_000 .. 1_000_000; package Fruit_IO is new Enumeration...

Page 1 of 1