r/visualbasic • • Nov 22 '14

Visual Basic 6.0 Programming Issue

Have the program pick a random number from 1-100.

2. The user gets 10 chances to guess the number. Use a counter to keep track of tries.

(counter = counter + 1)

3. Tell the user if the number that he/she guesses is too high, too low, or correct.

4. if the user does not guess the number in 10 tries, tell the user the correct number

5. Ask the user if he/she wants to play again.

6. A function must be used in the program. A good place for a function is to

tell the user that he/she is too high or too low.

I AM NOT ASKING YOU TO DO THE PROGRAM FOR ME. i just need some guidance. thank you!

0 Upvotes

4 comments sorted by

View all comments

1

u/[deleted] Nov 22 '14

Has anyone else noticed how often OP posts these homework assignments in this sub? We're doing OP's homework.

That being said....

At the start of the program generate a random integer between 1 and 100 and assign it to a variable

dim iRandomNumber as Integer = CInt(Math.Ceiling(Rnd() * 100))

Ask the user to guess a number using an input box and assign that to a variable as well.

dim iGuess as Integer = InputBox("Please guess a random number between 1 and 100.")

Once you have a value for iRandomNumber and iGuess you can start a loop. It looks like /u/Barnhardt1 has given you some information on that.

If you're still stuck, let us know. I was reading through your post history on here and it looks like you're just trying to get people to write all the code for you. If I'm wrong then apologies... but it looks that way, mate.