program hash2_2; uses simpleHash in 'simpleHash.pas'; var h1,h2: TStringHash; p1,p2: PHashEntry; n, i: cardinal; code: integer; s: string; begin n :=1; if ParamCount=1 then Val(ParamStr(1),n,code); h1:=TStringHash.Create; for i:=1 to 10000 do begin str(i, s); h1.add('foo_'+s,i); end; h2:=TStringHash.Create; for i:=1 to n do begin p1:=h1.getFirst; while p1<>nil do begin p2:=h2.get(p1^.Key); if p2=nil then h2.add(p1^.Key,p1^.Value) else inc(p2^.Value,p1^.Value); p1:=h1.getNext; end; end; writeLn(h1.get('foo_1')^.Value,' ', h1.get('foo_9999')^.Value,' ', h2.get('foo_1')^.Value,' ', h2.get('foo_9999')^.Value); h1.Destroy; h2.Destroy; end.