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

Username:   Password: 
 RegisterRegister   
 Rand.Int Command and Subtracting Arrays
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fear01




PostPosted: Thu Dec 01, 2005 9:12 pm   Post subject: Rand.Int Command and Subtracting Arrays

Uh could some explain how the Rand.Int command works? I have looked at the helped and tried it out myself but it says that the variable is of the wrong type. I am making a sort of trivia game and was wondering if, when a user answers a question correctly, how can i subtract that question out of the loop so it won't appear again? Thanks for the help.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Thu Dec 01, 2005 9:31 pm   Post subject: (No subject)

Rand.Int() works by taking two parameters, the lower number and the higher number (limits). Since it is a function, you have to "do" something with it, like outputting it or assigning it to a variable. You are most likely getting "wrong variable type" because you are not using an int to store the randomized number, ie:
code:
var randomNumber : int := Rand.Int (1, 10)

will generate a random number from 1 to 10.

As for deleting questions, look up arrays and store all the unanswered (or answered, your choice) questions in it.[/code]
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  [ 2 Posts ]
Jump to:   


Style:  
Search: