Computer Science Canada

How to do turing

Author:  unspoiled buddy [ Fri Apr 09, 2004 10:32 am ]
Post subject:  How to do turing

Hey guys,
wht' up



Thanks & REgds

unspolied buddy

Author:  Paul [ Fri Apr 09, 2004 11:19 am ]
Post subject: 

you use ord, I believe its 32 difference between uppercase and lower case. So to check it, it would be, assuming all liscence plates are as you say, this just changes all capitals to lower cases using chr and ord:
code:

var plate, letter:string
get plate
for a: 1..length(plate)
if ord(plate(a)) >= 97 and ord(plate(a)) <= 122 then%checks if its lowercase
plate:= plate(1..a-1)+chr(ord(plate(a))-32)+plate(a+1..*)%change to capital
end if
end for
put plate

Assuming your plate numbers will always be 7 digits, you just check for hyphen by using:
code:

%should put this before the code above
iif plate(4) not = "-" then
letter:=plate(*)
plate:=plate(1..3)+"-"+plate(5..*)+letter
end if

i


: