t98_realfunc.pas 453 B

12345678910111213141516171819202122232425262728293031
  1. program t98_realfunc;
  2. { t98 -- a REAL function result. `three' returns six bytes through the
  3. caller's scratch address; a VAR REAL parameter copies it into a record
  4. field, which Str then formats. }
  5. type
  6. R = record
  7. V : real;
  8. end;
  9. var
  10. A : R;
  11. S : string[10];
  12. function three : real;
  13. begin
  14. three := 3
  15. end;
  16. procedure put (var Z : real);
  17. begin
  18. Z := three
  19. end;
  20. begin
  21. A.V := 0;
  22. put (A.V);
  23. Str (A.V : 0 : 0, S);
  24. writeln (S)
  25. end.