ex31.pp 816 B

123456789101112131415161718192021222324252627282930313233
  1. Program Example26;
  2. { Program to demonstrate the MinValue function. }
  3. { Make sore integer is 32 bit}
  4. {$mode objfpc}
  5. Uses math;
  6. Type
  7. TExFloatArray = Array[1..100] of Float;
  8. TExIntArray = Array[1..100] of Integer;
  9. Var
  10. I : Integer;
  11. ExFloatArray : TExFloatArray;
  12. AFloatArray : PFloat;
  13. ExIntArray : TExIntArray;
  14. AintArray : PInteger;
  15. begin
  16. Randomize;
  17. AFloatArray:=@ExFloatArray[0];
  18. AIntArray:=@ExIntArray[0];
  19. for I:=1 to 100 do
  20. ExFloatArray[i]:=(Random-Random)*100;
  21. for I:=1 to 100 do
  22. ExIntArray[i]:=Random(I)-Random(100);
  23. Writeln('Min Float : ',MinValue(ExFloatArray):8:4);
  24. Writeln('Min Float (b) : ',MinValue(AFloatArray,100):8:4);
  25. Writeln('Min Integer : ',MinValue(ExIntArray):8);
  26. Writeln('Min Integer (b) : ',MinValue(AintArray,100):8);
  27. end.