Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Val(TextBox5.Text) = 0 Then
TextBox5.Text = 0
End If
TextBox5.Text = TextBox5.Text + 1
Dim percent As Double
percent = (TextBox3.Text)/100
Dim value As Integer = Integer.Parse(TextBox1.Text)
Dim flag As Integer = 0
Dim count As Integer = 0
Do While count < value
Dim rnd = New Random()
Dim nextValue = rnd.Next(100)/100
If nextValue < percent Then
flag = flag + 1
End If
count = count + 1
Loop
TextBox6.Text = value - flag
End Sub
如果我一步步调试控制进入循环我的代码工作正常。 但是,当我执行它直接控制不会在去循环代码没有进入For循环或做while循环
在循环中放置一个断点并按F5确认执行命中循环。 – Senthil 2015-04-05 03:09:55
如果存在中断点,则执行命中循环。但是,一旦我删除了中断点,它不会触及循环。 – meghan 2015-04-05 03:40:28
这意味着它在执行时间内工作正常。可能是一些逻辑问题,不能按照您的预期解决结果。检查你的逻辑和非常天真 – Senthil 2015-04-05 03:43:49