ex106.pp 529 B

123456789101112131415161718192021222324252627
  1. Program Example106;
  2. { Program to demonstrate the IndexDWord function. }
  3. Const
  4. ArraySize = 1000;
  5. MaxValue = 1000;
  6. Var
  7. Buffer : Array[1..ArraySize] of DWord;
  8. I,J : longint;
  9. K : DWord;
  10. begin
  11. Randomize;
  12. For I:=1 To ArraySize do
  13. Buffer[I]:=Random(MaxValue);
  14. For I:=1 to 10 do
  15. begin
  16. K:=Random(MaxValue);
  17. J:=IndexDWord(Buffer,ArraySize,K);
  18. if J=-1 then
  19. Writeln('Value ',K,' was not found in buffer.')
  20. else
  21. Writeln('Found ',K,' at position ',J,' in buffer');
  22. end;
  23. end.