|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function lngAckerman(ByVal intx As Integer, ByVal inty As Integer) As Long
' Procedure : lngAckerman
' Description: Calculates the Ackerman function.
' The Ackerman rating of a language is of interest.
' Calculate a small table of values for intX ranging from 0 to 5.
' Each column can be represented by a formula.
' If a language supports that formula, it has that Ackerman rating.
' Copyright: Chris Greaves Inc.
' Inputs: Two numbers.
' Returns: A rather large number.
' Assumes: Nothing
' Side Effects: Will probably blow stack space on any computer in existense when Ack(5,5) is attempted.
' Tested: By the calls shown below.
If intx = 0 Then
lngAckerman = inty + 1
Else
If inty = 0 Then
lngAckerman = lngAckerman(intx - 1, 1)
Else
lngAckerman = lngAckerman(intx - 1, lngAckerman(intx, inty - 1))
End If
End If
' Sub TESTlngAckerman()
' Dim intx As Integer
' Dim inty As Integer
' For intx = 0 To 3
' For inty = 0 To 3
' Debug.Print "x=" & intx & " y=" & inty & " Ackerman(X, y)=" & lngAckerman(intx, inty)
' Next inty
' Next intx
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |