Microsoft Small Basic

Program Listing:
Embed this in your website
'Neil Busse
TextWindow.WriteLine("Guess a number between 1-100")
'Varible
guess = Math.GetRandomNumber(100)
number: 'loop
num2 = TextWindow.ReadNumber()

If numguess = 0 Then
  numguess = numguess + 1
  EndIf
'If the number is greater then the Random number then To high else to low.

If num2 > guess Then
  TextWindow.WriteLine("Your guess is too high")
  numguess = numguess + 1
  Goto number
ElseIf num2 < guess then
  'If the you the right number then the program will tell you won.
  TextWindow.WriteLine("Your guess is too low")
  numguess = numguess + 1
  Goto number
  elseif num2 = guess Then
  TextWindow.Clear()
  TextWindow.WriteLine("It took you: " + numguess)
  TextWindow.WriteLine("Trys")
EndIf

TextWindow.WriteLine("Do you want to play again (y,n)")
yes = TextWindow.Read()

If yes = "y" Then
  'Get new random number, and reset number of guesses then loop.
  TextWindow.Clear()
  numguess = 0
  TextWindow.WriteLine("Pick anouther number")
  guess = Math.GetRandomNumber(100)
  Goto number
EndIf

If yes = "n" Then
  'if player doesnt want to play again then program close
  Program.End()
  EndIf









Copyright (c) Microsoft Corporation. All rights reserved.