fork download
  1. Imports System
  2.  
  3. Module Module1
  4. Const QUESTION_TYPE_ADDITION As Integer = 0
  5. Const QUESTION_TYPE_SUBTRACTION As Integer = 1
  6. Const QUESTION_TYPE_MULTIPLICATION As Integer = 2
  7. Const QUESTION_TYPE_DIVISION As Integer = 3
  8.  
  9. Public Class Test
  10. Public Shared RandomGenerator As Random
  11. Public Shared Question As String
  12. Public Shared Answer As Integer
  13. Public Shared Score As Integer
  14.  
  15. Public Shared Sub GenerateQuestion()
  16. ' Get the question type
  17. Dim QuestionType As Integer = RandomGenerator.Next(0, 3)
  18. Dim FirstNumber As Integer = RandomGenerator.Next(1, 100)
  19. Dim SecondNumber As Integer = RandomGenerator.Next(1, 100)
  20.  
  21. Select Case QuestionType
  22. Case QUESTION_TYPE_ADDITION
  23. Question = FirstNumber & " + " & SecondNumber & " = ?"
  24. Answer = FirstNumber + SecondNumber
  25.  
  26. Case QUESTION_TYPE_SUBTRACTION
  27.  
  28. Case QUESTION_TYPE_MULTIPLICATION
  29.  
  30. Case QUESTION_TYPE_DIVISION
  31.  
  32. Case Else
  33. Console.WriteLine("Something went wrong. ;-;")
  34. End Select
  35. End Sub
  36.  
  37. Public Shared Sub AskQuestion()
  38. Console.Clear()
  39. Console.WriteLine(Question)
  40.  
  41. Dim Entry As Integer = Console.Read()
  42. If Entry = Answer Then
  43. Console.WriteLine("Correct!")
  44. Score += 1
  45. Else
  46. Score -= 1
  47. End If
  48. End Sub
  49.  
  50. Public Shared Sub Main()
  51. Dim index as Integer = 1
  52.  
  53. While index <> 10
  54. GenerateQuestion()
  55. AskQuestion()
  56.  
  57. index += 1
  58. End While
  59.  
  60. Console.WriteLine("Your score is " & Score)
  61. End Sub
  62. End Class
  63. End Module
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5943 (Mono 3.8 - tarball)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.

vbnc : error VBNC30420: Could not find a 'Sub Main' in 'prog'.
There were 1 errors and 0 warnings.
Compilation took 00:00:01.0481890
stdout
Standard output is empty