谢谢了 !!!!!!
你不可能连这个都不会吧!
[此贴子已经被作者于2005-12-24 17:19:50编辑过]
Option Explicit
Private Sub Command1_Click()
Dim A(9) As Single
Dim i
For i = 0 To 9
A(i) = Rnd_made()
Text1(i).Text = Format(A(i), "##.00")
Next i
Call panduan(A)
End Sub
Private Function Rnd_made() As Single
Dim i As Integer '整数部分
Dim j As Integer '小数部分
Dim k As Single
Randomize
i = Int(Rnd * (10 - 5 + 1) + 5)
j = Int(Rnd * (99 - 0 + 1))
If i = 10 Then
Rnd_made = 10
Else
Rnd_made = i + j / 100
End If
End Function
Private Sub panduan(A() As Single)
Dim Min As Single
Dim Max As Single
Dim Average As Single, Sum As Single
Dim P_max As Integer, P_min As Integer '记住位置
Dim i As Integer
Max = A(0)
Min = A(0)
For i = 0 To 9
If A(i) > Max Then
Max = A(i)
P_max = i
ElseIf A(i) < Min Then
Min = A(i)
P_min = i
End If
Sum = Sum + A(i)
Next i
Average = (Sum - Max - Min) / 8 '平均值
Text2.Text = Format(Max, "##.00") '输出最大值
Text3.Text = Format(Min, "##.00") '输出最小值
Text4.Text = Format(Average, "##.00") '输出平均值
'以下将最大值和最小值凸显出来
Text1(P_max).FontItalic = True
Text1(P_max).FontBold = True
Text1(P_max).FontSize = 15
Text1(P_max).FontStrikethru = True
Text1(P_min).FontItalic = True
Text1(P_min).FontBold = True
Text1(P_min).FontSize = 15
Text1(P_min).FontStrikethru = True
End Sub
请客啊!!呵呵