Computer Science Canada

Turning integer into a character

Author:  chipanpriest [ 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?

Author:  Insectoid [ Mon Dec 19, 2011 2:09 pm ]
Post subject:  RE:Turning integer into a character

look up chr() and ord()

Author:  chipanpriest [ Tue Dec 20, 2011 9:16 pm ]
Post subject:  RE:Turning integer into a character

oh okay i got it thanks

Author:  mirhagk [ 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.

Author:  Velocity [ 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++


: