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

Username:   Password: 
 RegisterRegister   
 How do you keep count of the user's guesses
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
solblade05




PostPosted: Sat Jan 21, 2006 4:00 pm   Post subject: How do you keep count of the user's guesses

First off i'm gonaa start by saying that i know turing...NOT visual basic.

First of all i need to know how to create random numbers that don't show them selves in the text box.

then the user has toguess that number, and the program has to keep count of the # of guesses. after the user guesses the #, the msgbox displays the # of guesses it took
Sponsor
Sponsor
Sponsor
sponsor
HazySmoke)345




PostPosted: Sat Jan 21, 2006 9:57 pm   Post subject: (No subject)

Well, there's this function which creates a random number between 0 and 1. It's called Rnd. There's also this function that rounds your number down to the nearest integer, it's called Int. Now, take a minute and let those two ideas sink in............................ There we go. Let's say that you have the variable called "x" and you want "x" to be a random number between 0 and 100. You'd write:

VisualBASIC:
x = Int (Rnd * 101)
solblade05




PostPosted: Sat Jan 21, 2006 10:43 pm   Post subject: (No subject)

Quote:
code:

x = Int (Rnd * 101)


yeah...I Figured that out Smile , so how do you keep count? And Is it possible use elsif like in turing?
cool dude




PostPosted: Sun Jan 22, 2006 10:45 am   Post subject: (No subject)

to keep the number of guesses just make a variable count and then make an if statement

code:

if guess <> x then
       count = count + 1
end if



yes there is a elsif statement in VB and its the same thing pretty much "elseif"
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: