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

Username:   Password: 
 RegisterRegister   
 random characters?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Regole




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Blade




PostPosted: Mon Sep 15, 2003 5:13 pm   Post subject: (No 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)
Tony




PostPosted: Mon Sep 15, 2003 5:43 pm   Post subject: (No 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)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
krishon




PostPosted: Mon Sep 15, 2003 6:19 pm   Post subject: (No subject)

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




PostPosted: Mon Sep 15, 2003 8:18 pm   Post subject: (No 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?
Tony




PostPosted: Mon Sep 15, 2003 8:44 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: