Computer Science Canada

How do you keep count of the user's guesses

Author:  solblade05 [ 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

Author:  HazySmoke)345 [ Sat Jan 21, 2006 9:57 pm ]
Post 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)

Author:  solblade05 [ Sat Jan 21, 2006 10:43 pm ]
Post 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?

Author:  cool dude [ Sun Jan 22, 2006 10:45 am ]
Post 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"


: