-- shellitst.ada for comparison with shellitst.c and shellitst.f90 package Sort_Types is subtype Names is string(1..3) ; type A_Names is array(integer range <>) of Names ; type A_Balances is array(integer range <>) of float ; end Sort_Types ; with Sort_Types; use Sort_Types; procedure Shelli( Size : in integer ; Arr1 : in out A_Names ; Arr2 : in out A_Balances ) is M, I : integer ; Temp2 : float ; Temp1 : Names ; begin M := Size ; while M > 1 loop M := M / 2 ; for J in 1..Size-M loop I := J ; while I > 0 loop if Arr1(I) > Arr1(I+M) then Temp1 := Arr1(I) ; Arr1(I) := Arr1(I+M) ; Arr1(I+M) := Temp1 ; Temp2 := Arr2(I) ; Arr2(I) := Arr2(I+M) ; Arr2(I+M) := Temp2 ; I := I - M ; else exit ; end if ; end loop ; end loop ; end loop ; end Shelli ; with Text_IO; use Text_IO; with Sort_Types; use Sort_Types; with Shelli; procedure ShelliTST is package Flt_IO is new float_IO ( float ) ; use Flt_IO ; Account_Names : A_Names(1..20) := ("MMM","NNN","AAA","CCC","BBB","ZZZ","XXX", "PPP","QQQ","DDD","EEE","FFF","GGG","HHH", "III","JJJ","KKK","LLL","OOO","RRR") ; Balances : A_Balances(Account_Names'range) := (1.0,2.0,3.0,4.0,5.0,6.0, 7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0) ; begin for I in Account_Names'range loop Put(Account_Names(I)); Put(" "); Put(Balances(I)); New_Line; end loop ; Shelli(20, Account_Names, Balances ) ; Put_Line("Sorted by name" ); for I in Account_Names'range loop Put(Account_Names(I)); Put(" "); Put(Balances(I)); New_Line; end loop ; end ShelliTST;