-- Chapter 24 - Programming exercise 1 with Ada.Text_IO; use Ada.Text_IO; with Ada.Sequential_IO; procedure CH24_1 is type MY_REC is record Age : INTEGER; Sex : CHARACTER; Initial : CHARACTER; end record; package Seq_IO is new Ada.Sequential_IO(MY_REC); use Seq_IO; Myself : MY_REC; My_Out_File : Seq_IO.FILE_TYPE; Other_File : Seq_IO.FILE_TYPE; begin Create(My_Out_File, Out_File, "NAMEFILE.TXT"); Create(Other_File, Out_File, "OTHRFILE.TXT"); Myself.Sex := 'M'; for Index in 1..100 loop Myself.Age := Index; Myself.Initial := 'X'; Write(My_Out_File, Myself); if (Myself.Age >= 50) and (Myself.Age <= 60) then Myself.Initial := 'O'; Write(Other_File, Myself); else Write(Other_File, Myself); end if; end loop; Close(My_Out_File); Close(Other_File); end CH24_1; -- Result of Execution -- (The output is a binary file named NAMEFILE.TXT, -- and a binary file named OTHRFILE.TXT.)