Guest User

Untitled

a guest
Jan 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Public Class Form1
  2.  
  3. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4. Dim x, c As Integer
  5. Dim s As String
  6. MsgBox("Gissa talet mellan 1 och 100")
  7. Randomize()
  8. x = Int(Rnd() * 100) + 1
  9. start:
  10. For i = 0 To 5
  11. c = InputBox("Gissa talet")
  12. If c = x Then
  13. MsgBox("Du har gissat rätt")
  14. GoTo slut
  15. ElseIf c < x Then
  16. MsgBox("Du gissade för lågt")
  17. ElseIf c > x Then
  18. MsgBox("Du gissade för högt")
  19. End If
  20. Next i
  21. MsgBox("Du har gissat 6 gånger")
  22. slut:
  23. s = InputBox("Vill du spela igen? (J/N)")
  24. s = UCase(s)
  25. If s = "J" Then
  26. GoTo start
  27. Else
  28. Close()
  29. End If
  30. End Sub
  31. End Class
Add Comment
Please, Sign In to add comment