ex39.pp 521 B

12345678910111213141516171819202122232425
  1. Program ex39;
  2. { Program to demonstrate the TUnsortedStrCollection.Insert method }
  3. Uses Objects,Strings;
  4. Var C : PUnsortedStrCollection;
  5. S : String;
  6. I : longint;
  7. P : Pchar;
  8. begin
  9. Randomize;
  10. C:=New(PUnsortedStrCollection,Init(120,10));
  11. Writeln ('Inserting 100 records at random places.');
  12. For I:=1 to 100 do
  13. begin
  14. Str(Random(100),S);
  15. S:='String with value '+S;
  16. C^.Insert(NewStr(S));
  17. end;
  18. For I:=0 to 99 do
  19. Writeln (I:2,': ',PString(C^.At(i))^ );
  20. Dispose(C,Done);
  21. end.