Computer Science Canada

random characters?

Author:  Regole [ Mon Sep 15, 2003 5:11 pm ]
Post subject:  random characters?

Hello everyone I'm new, to this forum and to programming, I just started learning turing a little while ago, I have made some simple programs but nothing extraordinary. In any case I am having problems generating random characters (letters mainly) i using this code but it doesnt work
code:

var a ,b : int
randint (a, 65, 90)
randint (b, 97 ,122)
char (a) (b)

just to simply generate some random characters, but i dont understand what is wrong with it. There is an error that states "compile time expression expected" What does it mean? Any help would be appreciated.

Author:  Blade [ Mon Sep 15, 2003 5:13 pm ]
Post subject: 

you are using char when it should be chr

and shouldnt you have to put the letters out? like...

code:
var a,b: int
a:=Rand.Int(%lowerbound,%upperbound)
b:=Rand.Int(%lowerbound,%upperbound)
put chr(a), " ", chr(b)

Author:  Tony [ Mon Sep 15, 2003 5:43 pm ]
Post subject: 

dont worry if something doesnt work at first - thats usually the case with programming. You'll get used to syntax over time.

Check out some tutorials we got on various topics and if something doesnt make sence, post your questions 8)

Author:  krishon [ Mon Sep 15, 2003 6:19 pm ]
Post subject: 

like me when i did my rpg...that's how i got tony's, dan's and my post count up Wink

Author:  Regole [ Mon Sep 15, 2003 8:18 pm ]
Post subject: 

Thanks guys, lol, now I just need to figure out how to make my matrix-code thing work...better. Theres always a way, if only i had a better book lol, this one i'm reading was published 10 years ago. As you can tell a little inefficient, I haven't gotten through it all yet either. The problem with my matrix-code is the letters are not constantly changing, I have the random letters coming down at random columns, but they aren't changing and eventurally disappear leaving a lot of column space to be desired as well. I'm going to try to think of something...does anyone have any ideas?

Author:  Tony [ Mon Sep 15, 2003 8:44 pm ]
Post subject: 

oh, you can search for matrix codes on the forum... we had quite a bit of discussion with lots of different code examples (some are preaty good) a while ago. Go to search (up on top) and search for matrix in turing submissions or tutorials.


: