Microsoft Small Basic

Program Listing: GTS129
'Published ID#
'Choose a random number between 1 and 100 --#4.1 (fake with 42) & #13
answer = Math.GetRandomNumber(100)
'Do the following 8 times --#9
For i = 1 To 8
' Ask the user for a guess. --#1
guess = MessageBox.AskForInput("Guess a number between 1-100")
'If the guess is less than 1 or the guess is greater than 100
If (guess < 1) or (guess > 100)Then
'Tell the user they need to guess a number greater than 0 or less than 100
MessageBox.ShowMessage("hey dummy, pick a number greater than 0 or less than 100")
'Tell the user to start over
MessageBox.ShowMessage("start over")
'Exit the Program
Program.End()
Endif
' If the guess is correct --#4
If (guess = answer) Then
' Play a bell --#2
Sound.PlayBellRingAndWait()
' Tell the user that they won the game --#3
MessageBox.ShowMessage("You won!")
' Exit the Program --#10
Program.End()
' Otherwise, if the guess is too high --#6
ElseIf (guess > answer) Then
' Tell the end user that it is too high --#5
MessageBox.ShowMessage("Too High")
' Otherwise, if the guess is too low --#8
ElseIf (guess < answer) Then
' Tell the end user that it is too low --#7
MessageBox.ShowMessage("Too Low")
EndIf
'Repeat --#9
EndFor
'If after 8 times they haven't guessed correctly then --#12 (blank)