This little program is basically a program that randomly generates a number and you have to guess it. Here it is:
Scan report for https://www.dropbox.com/s/nlv1eu7yisnutnv/Game.rar?dl=0 at2014-09-30 16:44:19 UTC - VirusTotal
Online Virus Scanner
Dropbox - Game v2.rar
' Variables Dim Guess, Number As Integer Dim Space As String Start: Console.Clear() ' Randomizer Randomize() Number = Int(Rnd() * 10) + 1 Space = " " Console.WriteLine() Console.WriteLine(Space & "Guess the number game") Console.WriteLine(Space & "=====================") Console.WriteLine() Console.WriteLine("I am thinking of a number between 1 and 10.") Console.WriteLine() Console.Write("Enter a number: ") Guess = Console.ReadLine ' If 1 If Guess = Number Then GoTo CorrectGuess End If ' If 2 If Guess Number Then Console.Write("Your guess is too high, try again: ") End If Guess = Console.ReadLine() ' If 3 If Guess Number Then Console.Write("Your guess is too high, try again: ") End If Guess = Console.ReadLine() ' If 4 If Guess = Number Then GoTo CorrectGuess Else GoTo IncorrectGuess End If IncorrectGuess: Console.WriteLine() Console.WriteLine("Unlucky, you lost. The actual number was " & Number) Console.ReadLine() GoTo Start End CorrectGuess: Console.WriteLine() Console.WriteLine("Well done, you guessed correctly. Moving on to level 2.") Console.ReadLine() GoTo Level2 Console.WriteLine("Welcome to level 2.") End Level2: Console.Clear() Console.WriteLine() Console.WriteLine(Space & "Guess the number game Level 2") Console.WriteLine(Space & "=============================") Console.WriteLine() Console.WriteLine("I am thinking of a number between 1 and 20.") Console.WriteLine() Console.Write("Enter a number: ") Guess = Console.ReadLine ' Randomizer Randomize() Number = Int(Rnd() * 20) + 1 ' If 1 If Guess = Number Then GoTo CorrectGuess2 End If ' If 2 If Guess Number Then Console.Write("Your guess is too high, try again: ") End If Guess = Console.ReadLine() ' If 3 If Guess Number Then Console.Write("Your guess is too high, try again: ") End If Guess = Console.ReadLine() ' If 4 If Guess = Number Then GoTo CorrectGuess2 Else GoTo IncorrectGuess2 End If IncorrectGuess2: Console.WriteLine() Console.WriteLine("Unlucky, you lost. The actual number was " & Number) Console.ReadLine() GoTo Start End CorrectGuess2: Console.WriteLine() Console.WriteLine("Well done, you guessed correctly.") Console.ReadLine() GoTo Start End
There's a little bug that only affects the game if you guess correctly on second attempt, just close it and reopen.