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

Username:   Password: 
 RegisterRegister   
 Turning integer into a character
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chipanpriest




PostPosted: Mon Dec 19, 2011 2:01 pm   Post subject: Turning integer into a character

Okay, I am trying to make a program that randomly generates a letter. Simple as that.

This is what I have
Turing:
var letter : string
var ch : int
var font := Font.New ("Comic Sans MS:30:bold")

randint (ch,65,122)
letter := intstr (ch)

Draw.Text (letter,100,100,font,7)


Now, this works, but not the way I want it to. I displays the actual number where I want to display the letter that the integer represents. like how 65 = A etc. Any help?
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Mon Dec 19, 2011 2:09 pm   Post subject: RE:Turning integer into a character

look up chr() and ord()
chipanpriest




PostPosted: Tue Dec 20, 2011 9:16 pm   Post subject: RE:Turning integer into a character

oh okay i got it thanks
mirhagk




PostPosted: Wed Dec 21, 2011 9:23 am   Post subject: RE:Turning integer into a character

cheat also works in this circumstance, although it's not recommended.
Velocity




PostPosted: Tue Dec 27, 2011 9:47 pm   Post subject: RE:Turning integer into a character

chr is char to int ord is int to chr... or other way around, i have not used turing in almost 4 DAYS! lol fail <<< i did use C++
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  [ 5 Posts ]
Jump to:   


Style:  
Search: