ex26.pp 815 B

1234567891011121314151617181920212223242526272829303132
  1. Program Example26;
  2. { Program to demonstrate the MaxValue 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. ExIntArray : TExIntArray;
  13. AFLoatArray : PFLoat;
  14. AIntArray : PInteger;
  15. begin
  16. Randomize;
  17. AFloatArray:=@ExFloatArray[1];
  18. AIntArray:=@ExIntArray[1];
  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('Max Float : ',MaxValue(ExFloatArray):8:4);
  24. Writeln('Max Float (b) : ',MaxValue(AFloatArray,100):8:4);
  25. Writeln('Max Integer : ',MaxValue(ExIntArray):8);
  26. Writeln('Max Integer (b) : ',MaxValue(AIntArray,100):8);
  27. end.