abracadaver
Member
Ok, so End of semester is gettung near and I have to finish my last VB prject, and I am truly screwed on it. First of all, let's note that my skill in VB is sub-par, to put it kindly. So I have about a week to finish making a "magic numbers" game (e.g. guessing random numbers form 1-10 generated randomly). You get 3 guesses at the number. The app must keep track of how many games you win and how many games your computer wins. After 3 rounds, the computer should display the score between you and the app. My teacher has been away, and the sub is a bit over her head, so I figured I'd ask here. I'll paste the code that I have so far here, hopefully you guys can give me some advice, or direct me to a good Visual Basic help forum. Thanks in advance.
Private Sub Form_Load()
Dim games, guess, UserGuess, CompNum, userscore, compscore As Integer
For games = 1 To 3
CompNum = Int((10 - 1 + 1) * Rnd + 1)
Do
UserGuess = InputBox("Guess a number between 1 and 10", "Guessing Game")
If UserGuess > CompNum Then MsgBox " Your guess is too high! "
If UserGuess < CompNum Then MsgBox " Your guess is too low! "
If UserGuess = CompNum Then MsgBox " Correct! "
If UserGuess = CompNum Then userscore = userscore + 1
End If
Loop Until UserGuess = CompNum Or guess = 3
Next
End Sub
Private Sub Form_Load()
Dim games, guess, UserGuess, CompNum, userscore, compscore As Integer
For games = 1 To 3
CompNum = Int((10 - 1 + 1) * Rnd + 1)
Do
UserGuess = InputBox("Guess a number between 1 and 10", "Guessing Game")
If UserGuess > CompNum Then MsgBox " Your guess is too high! "
If UserGuess < CompNum Then MsgBox " Your guess is too low! "
If UserGuess = CompNum Then MsgBox " Correct! "
If UserGuess = CompNum Then userscore = userscore + 1
End If
Loop Until UserGuess = CompNum Or guess = 3
Next
End Sub