ex83.pp 367 B

12345678910111213141516171819
  1. Program Example82;
  2. {$mode objfpc}
  3. { This program demonstrates the StrToInt function }
  4. Uses sysutils;
  5. Begin
  6. Writeln (StrToIntDef('1234',0));
  7. Writeln (StrToIntDef('-1234',0));
  8. Writeln (StrToIntDef('0',0));
  9. Try
  10. Writeln (StrToIntDef('12345678901234567890',0));
  11. except
  12. On E : EConvertError do
  13. Writeln ('Invalid number encountered');
  14. end;
  15. End.