帮忙一下完成程序,拜托了

2025-01-19 16:34:00
推荐回答(2个)
回答1:

第一题和第三题,希望有帮助~

Private Function Average(ByRef x() As Long) As Double
mmax = x(1)
mmin = x(1)
ssum = x(1)
For i = 2 To 10 Step 1
If x(i) > mmax Then
mmax = x(i)
End If
If x(i) < Min Then
mmin = x(i)
End If
ssum = ssum + x(i)
Next
Average = (ssum - mmax - mmin) / 8
End Function

Private Function GetMoney(ByVal x As Double) As Double
If x > 2 Then
GetMoney = 0.8 * x * 1.5
Else
GetMoney = x * 1.5
End If
End Function

Private Sub Main()
Dim x(1 To 10) As Long

For i = 1 To 10
x(i) = Rnd() * 5 + 5
Next

a = Average(x)
b = GetMoney(3)

End Sub

回答2:

EXELC的函数是带有的!