-- Chapter 24 - Programming exercise 2 with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; with Ada.Sequential_IO; procedure CH24_2 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, Other : MY_REC; My_In_File : Seq_IO.FILE_TYPE; Other_File : Seq_IO.FILE_TYPE; begin Open(My_In_File, In_File, "NAMEFILE.TXT"); Open(Other_File, In_File, "OTHRFILE.TXT"); for Index in 1..100 loop Read(My_In_File, Myself); Read(Other_File, Other); if (Myself.Age /= Other.Age) or (Myself.Sex /= Other.Sex) or (Myself.Initial /= Other.Initial) then Put("Record number"); Put(Myself.Age); Put(" "); Put(Myself.Sex); Put(" "); Put(Myself.Initial); Put(Other.Age,12); Put(" "); Put(Other.Sex); Put(" "); Put(Other.Initial); New_Line; end if; end loop; Close(My_In_File); Close(Other_File); end CH24_2; -- Result of Execution -- Record number 50 M X 50 M O -- Record number 51 M X 51 M O -- Record number 52 M X 52 M O -- Record number 53 M X 53 M O -- Record number 54 M X 54 M O -- Record number 55 M X 55 M O -- Record number 56 M X 56 M O -- Record number 57 M X 57 M O -- Record number 58 M X 58 M O -- Record number 59 M X 59 M O -- Record number 60 M X 60 M O