0

今晚的最后一个问题。我将如何重新编写此代码以不再通过返回值返回商,而是使用引用参数返回有关商的信息?

Function divideInputs(ByVal dividend As Integer, ByVal divisor As Integer) As Double
  Dim quotient As Integer = 1
quotient = dividend / divisor
Return quotient
End Function
4

1 回答 1

0

尝试这个:

Sub divideInputs(ByVal dividend As Integer, ByVal divisor As Integer, ByRef quotient As Integer)
    quotient = dividend / divisor
End Sub

然后调用逻辑,执行以下操作:

Dim q As Integer
divideInputs(6, 3, q)
于 2013-10-28T03:32:13.107 回答