Dim ary(4, 5) As Integer
Dim mark(4, 5) As String
Dim sum As Integer
Dim avg As Integer
Private Sub Command1_Click()
For i = 0 To 3
For j = 0 To 4
Randomize Timer
ary(i, j) = Int(89 * Rnd + 10) '10-99
sum = sum + ary(i, j) '和
Text1.Text = Text1.Text & ary(i, j) & " "
Next j
Text1.Text = Text1.Text & vbCrLf
Next i
avg = sum / 20 '平均数
End Sub
Private Sub Command2_Click()
For i = 0 To 3
For j = 0 To 4
If ary(i, j) > avg Then mark(i, j) = "H"
If ary(i, j) = avg Then mark(i, j) = "E"
If ary(i, j) < avg Then mark(i, j) = "L"
Text2.Text = Text2.Text & mark(i, j) & " "
Next j
Text2.Text = Text2.Text & vbCrLf
Next i
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
sum = 0
avg = 0
Command1.SetFocus
End Sub
Private Sub Form_Load()
'Text1.MultiLine = True '在窗体主设计中将多行设为TRUE
'Text2.MultiLine = True
Text1.Text = ""
Text2.Text = ""
End Sub
你好,
这种情况考虑与钙片刺激胃肠道有关.建议饭后服用