到目前为止,当您输入字母时,我的数字有效,但我不知道如何使数字有效。我可以帮助使数字和字母一样有效吗?
var var_name : string
function check_letter (ch : string (1)) : int
if ord (ch) >= 65 and ord (ch) <= 90 then
result 1
end if
if ord (ch) >= 97 and ord (ch) <= 122 then
result 1
end if
if ord (ch) >= 0 and ord (ch) <= 9 then
result 1
end if
result 0
end check_letter
put "please enter the postal code"
get var_name
for i : 1 .. length (var_name)
if check_letter (var_name (i)) = 1 then
put "postal code valid"
else
put "postal code invalid"
end if
end for