Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to do turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
unspoiled buddy




PostPosted: Fri Apr 09, 2004 10:32 am   Post subject: How to do turing

Hey guys,
wht' up



Thanks & REgds

unspolied buddy
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Fri Apr 09, 2004 11:19 am   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: