-- Make an array of Empl, and functions to read or print them. -- We keep an accompanying int, to track how many of the array-locations -- actually represent real (non-junk) data. -- -- TODO: combine array-and-its-int into one 'thing'. with ada.text_io; use ada.text_io; with ada.integer_text_io; use ada.integer_text_io; with ada.long_integer_text_io; use ada.long_integer_text_io; with ada.float_text_io; use ada.float_text_io; procedure sample is type Empl is record name: string(1..20); id: string(1..6); salary: Long_Integer; -- in cents end record; type Empls is array(1..10) of Empl; procedure readMany( staffers: out Empls; i: out Natural ) is temp: Empl; begin i := 0; while not end_of_file loop i := i+1; get(temp.name); get(temp.id); get(temp.salary); staffers(i) := temp; end loop; end readMany; procedure printMany( staffers: in Empls; staffSize: Natural ) is begin for j in 1..staffSize loop put(staffers(j).name); put(staffers(j).id); put(staffers(j).salary); new_line; end loop; end printMany; Staff: Empls; staffSize: Natural; begin readMany(staff, staffSize); printMany(staff, staffSize); end sample; -- @author ibarland -- @license: CC0: You may freely copy, modify, or distribute this code, without restriction. -- https://creativecommons.org/publicdomain/zero/1.0/legalcode