Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.22 KB | None | 0 0
  1. Public Class Form1
  2.  
  3.     Private Sub rerand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rerand.Click
  4.         Dim rand1, rand2, rand3, rand4, count, number As Integer
  5.         Randomize()
  6.         rand1 = 1 + Int(Rnd() * 6)
  7.         rand2 = 1 + Int(Rnd() * 6)
  8.         rand3 = 1 + Int(Rnd() * 6)
  9.         rand4 = 1 + Int(Rnd() * 6)
  10.         r1.Text = "ספרה מספר 1: " & rand1
  11.         r2.Text = "ספרה מספר 2: " & rand2
  12.         r3.Text = "ספרה מספר 3: " & rand3
  13.         r4.Text = "ספרה מספר 4: " & rand4
  14.         count = 1
  15.         number = 0
  16.         number += rand4 * count
  17.         count *= 10
  18.         number += rand3 * count
  19.         count *= 10
  20.         number += rand2 * count
  21.         count *= 10
  22.         number += rand1 * count
  23.         num.Text = "המספר שהוגרל הוא: " & number
  24.         If number > 5000 Then
  25.             state.Text = "המספר גדול מ-5000"
  26.         ElseIf number < 5000 Then
  27.             state.Text = "המספר קטן מ-5000"
  28.         Else
  29.             state.Text = "המספר שווה ל-5000"
  30.         End If
  31.     End Sub
  32.  
  33.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  34.         Dim rand1, rand2, rand3, rand4, count, number As Integer
  35.         Randomize()
  36.         rand1 = 1 + Int(Rnd() * 6)
  37.         rand2 = 1 + Int(Rnd() * 6)
  38.         rand3 = 1 + Int(Rnd() * 6)
  39.         rand4 = 1 + Int(Rnd() * 6)
  40.         r1.Text = "ספרה מספר 1: " & rand1
  41.         r2.Text = "ספרה מספר 2: " & rand2
  42.         r3.Text = "ספרה מספר 3: " & rand3
  43.         r4.Text = "ספרה מספר 4: " & rand4
  44.         count = 1
  45.         number = 0
  46.         number += rand4 * count
  47.         count *= 10
  48.         number += rand3 * count
  49.         count *= 10
  50.         number += rand2 * count
  51.         count *= 10
  52.         number += rand1 * count
  53.         num.Text = "המספר שהוגרל הוא: " & number
  54.         If number > 5000 Then
  55.             state.Text = "המספר גדול מ-5000"
  56.         ElseIf number < 5000 Then
  57.             state.Text = "המספר קטן מ-5000"
  58.         Else
  59.             state.Text = "המספר שווה ל-5000"
  60.         End If
  61.     End Sub
  62. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement