从键盘上输入一个数,输出该数的平方根: Function SquareRoot(x As Double) As Double Select Case Sgn(x) Case 1 SquareRoot = Sqr(x) Exit Function Case 0 SquareRoot = 0 Case -1 SquareRoot = -1 End Select End Function
Private Sub Form_Click()
Dim Msg, SqrN Dim n As Double n = InputBox("请输入要计算平方根的数:") Msg = n & "的平方根" SqrN = Sqr(n) Select Case SqrN Case 0 Msg = Msg & "是 0" Case -1 Msg = Msg & "是一个虚数" Case Else Msg = Msg & "是" & Sqr(n) End Select MsgBox Msg End Sub 请问代码中SquareRoot过程有什么用呢?? 我看不出在哪调用了??? 请指教!!!
[此贴子已经被作者于2005-6-8 13:26:04编辑过]