TIP: Click on subject to list as thread! ANSI
echo: pascal
to: ALL
from: `Sabine Fischer`
date: 2000-02-13 00:00:00
subject: Re: Which Variable Type Should I Use?

lee connell schrieb in Nachricht
...
>I have to make a wages program for my first assignment.
>
>Firstly
>The date has to be entered. format  im using is dd, mm, yyyy
>I check that month is in the range 1 - 12 - that is ok..... If user types a
>alphanumeric char in ... program naturally returns with a INVALID FORMAT
>error....
>
>How can an integer response be error trapped so that no alphanumeric
>characters can be entered???
You could read the integer into a string and then convert it.
-----
var
  S: String;
  Int, Code: integer;

begin
  repeat
    writeln('Enter Day');
    readln(S);
    val(S,Int,Code);
    if Code  0 then writeln('Wrong format');
  until Code = 0;
end;
-----
Sabine

SOURCE: alt.fidonet via archive.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.