Working with unconstrained arrays in ada record -


i have assignment not know number of entries there prior getting them user. in assignment, use unbounded arrays. once user states maximum number, used upper bound of array, , there 3 of these declarations. then, need accept value fill each of tose arrays held in record, held in array. then, once populated, array needs passed procedure output screen.

i have put demo of needs happen. not assignment, rough idea/pseudo of 1 small spart of larger assignment. right away running problem of using unconstrained array in record.

with ada.text_io; use ada.text_io; ada.integer_text_io; use ada.integer_text_io;      procedure vehicles        type year_array array (positive range <>) of integer;        type vehicle_record           record              name: string (1 .. 40);              cars_array : year_array;              trucks_array: year_array;              bikes_array : year_array;           end record;        type o_array array (1 .. 4) of vehicle_record;         procedure get_no_vehicles (cars, trucks, bikes :    out positive)        begin           put("total number of cars:");           get(cars);           put("total number of trucks:");           get(trucks);           put("total number of bikes:");           get(bikes);        end get_no_vehicles;         owner   : o_array;        cars, trucks, bikes : positive;     begin        get_no_vehicles(cars, trucks, bikes);     -- call procedure the owner name , year of each vehicle 4 owners.     -- call procedure pull records owner array , output screen.     end vehicles; 

does have suggestion on how make work? thought creating record in declare block, go out of scope when before can pass procedure output entire array.i not sure how proceed. taking time look.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -