Guidance
指路人
g.yi.org
software / rapidq / Examples / Algorithm & Maths / Recurse.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'From:"Jacques Philippe" Wed, 14 Aug 2002 10:52:57 +0000
' an example of a recursive function !

' -----Start Recursive test ---------------------------------
     $ESCAPECHARS ON
     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"

     DECLARE FUNCTION DecRecursivly (iNumber AS LONG) AS LONG
     DECLARE SUB DecRec
     DECLARE SUB OnTimer_tmr
     DEFINT iLoop
'
' Set The number of recursive calls desired (Stack overflow if iLoop too high from 4000 to ???)
     iLoop = 500
'
     DIM tmr AS QTIMER
     tmr.Interval = 50
     tmr.Enabled = True
     tmr.OnTimer = OnTimer_tmr

     DecRecursivly (iLoop)
'DecRec

Erreur:
' -------------------------------------------------------------
' EXIT CONSOLE
' ------------
     DEFSTR sExit
     INPUT "\n\n                    CR to QUIT \n\n", sExit
     Application.Terminate
     END
'
     FUNCTION DecRecursivly (iNumber AS LONG) AS LONG
      DEC iNumber
      iLoop = iNumber
      DOEVENTS
      IF iNumber > 0 THEN DecRecursivly (iNumber)
     END FUNCTION
'
     SUB DecRec
      DEC iLoop
      DOEVENTS
      IF iLoop > 0 THEN DecRec
     END SUB
'
     SUB OnTimer_tmr
      PRINT iLoop
     END SUB
' ------ END --------------------------------------------------
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2022-9-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-07-25 17:30:54