ex68.pp 872 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. Program Example68;
  2. { This program demonstrates the FloatToStrF function }
  3. Uses sysutils;
  4. Const Fmt : Array [TFloatFormat] of string[10] =
  5. ('general','exponent','fixed','number','Currency');
  6. Procedure Testit (Value : Extended);
  7. Var I,J : longint;
  8. FF : TFloatFormat;
  9. begin
  10. For I:=5 to 15 do
  11. For J:=1 to 4 do
  12. For FF:=ffgeneral to ffcurrency do
  13. begin
  14. Write (Value,'(Prec: ',I:2,', Dig: ',J,', fmt : ',Fmt[ff],') : ');
  15. Writeln (FloatToStrf(Value,FF,I,J));
  16. Write (-Value,'(Prec: ',I:2,', Dig: ',J,', fmt : ',Fmt[ff],') : ');
  17. Writeln (FloatToStrf(-Value,FF,I,J));
  18. end;
  19. end;
  20. Begin
  21. Testit (1.1);
  22. Testit (1.1E1);
  23. Testit (1.1E-1);
  24. Testit (1.1E5);
  25. Testit (1.1E-5);
  26. Testit (1.1E10);
  27. Testit (1.1E-10);
  28. Testit (1.1E15);
  29. Testit (1.1E-15);
  30. Testit (1.1E100);
  31. Testit (1.1E-100);
  32. End.