Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim numberToGuess As Integer
- Dim guess As Integer
- Dim win As Boolean = False
- Dim guessoutcome As String
- numberToGuess = RandomNumber()
- Do
- guess = GetInput()
- guessoutcome = isitHiLoOrRight(guess, numberToGuess)
- If guessoutcome = "Right" Then
- win = True
- OutputResult(guessoutcome)
- Else
- win = False
- OutputResult(guessoutcome)
- End If
- Loop Until win = True
- End Sub
- Function RandomNumber() As Integer
- Randomize()
- Return Math.Ceiling(Rnd() * 100)
- End Function
- Function GetInput() As Integer
- '+loads of validation
- Console.WriteLine("sdfghjk")
- Return Console.ReadLine
- End Function
- Function isitHiLoOrRight(ByRef guess As Integer, ByVal hiddenNumber As Integer)
- If guess = hiddenNumber Then
- Return "Right"
- ElseIf guess > hiddenNumber Then
- Return "Hi"
- Else
- Return "Lo"
- End If
- 'do the compare Return "Hi","lo" or "Right"
- End Function
- Sub OutputResult(ByVal outcome As String)
- Console.WriteLine("Your guess was " & outcome)
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement