Turning integer into a character
Author |
Message |
chipanpriest
![](http://compsci.ca/v3/uploads/user_avatars/2500543034edeb81cb83e9.jpg)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Dec 19, 2011 2:09 pm Post subject: RE:Turning integer into a character |
|
|
look up chr() and ord() |
|
|
|
|
![](images/spacer.gif) |
chipanpriest
![](http://compsci.ca/v3/uploads/user_avatars/2500543034edeb81cb83e9.jpg)
|
Posted: Tue Dec 20, 2011 9:16 pm Post subject: RE:Turning integer into a character |
|
|
oh okay i got it thanks |
|
|
|
|
![](images/spacer.gif) |
mirhagk
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Velocity
![](http://compsci.ca/v3/uploads/user_avatars/1809397984eb9e2888e99b.jpg)
|
Posted: 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++ |
|
|
|
|
![](images/spacer.gif) |
|
|