5 回答

TA貢獻(xiàn)1828條經(jīng)驗 獲得超4個贊
怎么測試,oracle function函數(shù)
比如你定義了一個函數(shù):
create FUNCTION y2
(inx2 number)
return number is
Result number(2);
begin
Result := inx2*inx2;
return(Result);
end y2;

TA貢獻(xiàn)1831條經(jīng)驗 獲得超4個贊
Private Sub Command1_Click()
n = CInt(InputBox("N="))
y = fac(n)
MsgBox n & "!=" & y
End Sub
Function fac(n)
If n = 0 Or n = 1 Then fac = 1 Else fac = n * fac(n - 1)
End Function

TA貢獻(xiàn)1806條經(jīng)驗 獲得超8個贊
Private Sub Command1_Click()
a = CInt(Text1.Text)
b = CInt(Text2.Text)
x = 0
gcd a, b, x
Label1.Caption = "Gcd(" & a & "," & b & ")=" & x
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Text1.Text = ""
Text2.Text = ""
End Sub
Sub gcd(a, b, x)
If a Mod b = 0 Then
x = b
Else
gcd b, a Mod b, x
End If
End Sub

TA貢獻(xiàn)1856條經(jīng)驗 獲得超5個贊
1 2 3 4 5 6 7 8 | Function Factorial(n As Integer) As Double If Factorial = 0 Then Factorial = 1 If n > 1 Then Factorial = n * Factorial(n - 1) End Function
Private Sub Form_Click() '點擊窗體運行 MsgBox "階乘計算結(jié)果為 " & Factorial(Val(InputBox("請輸入一個整數(shù),不要太大"))) End Sub |

TA貢獻(xiàn)1784條經(jīng)驗 獲得超8個贊
Private Function Factorial1(intN As Integer) As Integer
If intN = 0 Then
Factorial1 = 1
Else
Factorial1 = Factorial1(intN - 1) * intN
End If
End Function
添加回答
舉報