Private Sub Form_Load()Me.HideOpen App.Path & "\out.txt" For Output As #2Call A1(2)Call A1(3)CloseEndEnd SubSub A1(a)Dim F As Double, L As Double, k As DoubleF = 1: L = 2Do Until F > L Or k ^ a = ak = (F + L) / 2If k ^ a > a Then L = k - 0.001If k ^ a < a Then F = k + 0.001LoopPrint #2, kEnd Sub
Private Sub Form_Load()Me.HideOpen App.Path & "\out.txt" For Output As #2Call ABC(2)Call ABC(3)Close #2EndEnd SubSub ABC(A)S = 1F = 2M = (S + F) / 2B = A ^ (1 / A)Do Until M = BIf B > M Then S = MIf B < M Then F = MM = (S + F) / 2LoopPrint #2, MEnd Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\out.txt" For Output As #2
Call A1(2)
Call A1(3)
Close
End
End Sub
Sub A1(a)
Dim F As Double, L As Double, k As Double
F = 1: L = 2
Do Until F > L Or k ^ a = a
k = (F + L) / 2
If k ^ a > a Then L = k - 0.001
If k ^ a < a Then F = k + 0.001
Loop
Print #2, k
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\out.txt" For Output As #2
Call ABC(2)
Call ABC(3)
Close #2
End
End Sub
Sub ABC(A)
S = 1
F = 2
M = (S + F) / 2
B = A ^ (1 / A)
Do Until M = B
If B > M Then S = M
If B < M Then F = M
M = (S + F) / 2
Loop
Print #2, M
End Sub