问题在textbox1中随即产生随机数 并计算平均数
一个text 一个button产生随机数 一个text 一个button 用于计算平均数
随机数我产生了,但不会在textbox2中引用产生的随机数
那位大哥给我改改button2啊,1我不想改了,就那样,现在就不会引用随机数到button2了
Public Class Form1
Dim a As New ArrayList()
Dim i, n, z(100) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
Dim a As New ArrayList()
Dim i, n, z(100) As Integer
n = Int(Rnd(0.1) * (100))
For i = 1 To n
z(i) = Int(Rnd(0.1) * (90) + 10)
TextBox1.Text = TextBox1.Text & z(i) & " "
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim d, n, m As Double
For i = 1 To n
d = d + z(i)
m = d / n
TextBox2.Text = m
Next
End Sub
End Class