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
|