VB求从键盘输入10个整数的平均值,最大值,最小值
Private Sub Form_Load() Dim tmp_Int(1 To 10) As Long Dim CircleDo As Integer Dim Totol As Variant: Totol = 0 Dim MinValue As Long, MaxValue As Long, AveValue As Single MinValue = 2147483647 MaxValue = -2147483647 For CircleDo = LBound(tmp_Int) To UBound(tmp_Int) ...全部
Private Sub Form_Load() Dim tmp_Int(1 To 10) As Long Dim CircleDo As Integer Dim Totol As Variant: Totol = 0 Dim MinValue As Long, MaxValue As Long, AveValue As Single MinValue = 2147483647 MaxValue = -2147483647 For CircleDo = LBound(tmp_Int) To UBound(tmp_Int) tmp_Int(CircleDo) = Int(InputBox("请输入第 " & CircleDo & " 个整数")) If MinValue > tmp_Int(CircleDo) Then MinValue = tmp_Int(CircleDo) If MaxValue Totol = Totol tmp_Int(CircleDo) Next CircleDo AveValue = Totol / 10 MsgBox "最小值 " & MinValue & ";最大值 " & MaxValue & ";平均值 " & AveValue & ";总和 " & TotolEnd Sub。
收起