t103_valreal.pas 426 B

12345678910111213141516171819202122
  1. program t103_valreal;
  2. { t103 -- Val on a REAL destination. The counted source is copied to an
  3. ASCIIZ buffer by val_real, then parsed by the same ascreal core. }
  4. var
  5. S : string[20];
  6. R : real;
  7. E : integer;
  8. begin
  9. S := '1.5';
  10. Val (S, R, E);
  11. Str (R : 0 : 1, S);
  12. writeln (S, ' ', E);
  13. S := '-2.25';
  14. Val (S, R, E);
  15. Str (R : 0 : 2, S);
  16. writeln (S, ' ', E);
  17. S := '3.5x';
  18. Val (S, R, E);
  19. writeln (E)
  20. end.