Guessing game computer program in Visual Basic
John Thorpe
Dim random_number As Integer
Dim guess As Integer
Dim guess_count As Integer
guess_count = 1
Randomize
random_number = Int(Rnd * 100) + 1
Do
guess = InputBox("Please guess number between 1 and 100")
If guess <> random_number Then
guess_count = guess_count + 1
If guess > random_number Then
txtPrynt.Text = "Sorry, too high"
Else
txtPrynt.Text = "Sorry, too low"
End If
End If
Loop Until guess = random_number
txtPrynt.Text = "Well done. You guessed the answer in " + Str(guess_count) + " goes"
Comments (0)
You don't have permission to comment on this page.