Public Function gongzi(m As Double) Dim k As Integer If m = 0 Then gongzi = 0 End If If 0 < m And m < 2.4 Then gongzi = 600 End If If 2.4 <= m Then gongzi = 600 k = 10 * (Application.WorksheetFunction.RoundDown((m - 2.3), 1)) For i = 1 To k gongzi = gongzi + (10 * i + 20) Next If (m - 2.3) * 10 - k = 0 Then gongzi = gongzi Else gongzi = gongzi + CInt(Right(CStr((m - 2.3)), 1)) * (30 + 10 * k) / 10 End If End If End Function 帮我看看,为什么没m=2.4时结果是634而不是630,如果要为630要怎么改,郁闷! 好像没有做If (m - 2.3) * 10 - k = 0 Then这个判断
[此贴子已经被作者于2006-10-30 16:26:08编辑过] |