强大的批处理 (2) Fibonacci函数 语言 Add comments三 042009 小无聊一下,不过真的很强大……123456789101112131415161718192021222324252627@ECHO OFF SETLOCAL SET X=10 CALL :Fib %X% Y ECHO Fib^(%X%^)=%Y% GOTO :EOF :Fib [In]X [Out]Result SETLOCAL SET A=%1 SET D=1 SET E=0 IF %A% LEQ 1 ( GOTO FibRet ) SET /A B=%A%-1 SET /A C=%A%-2 CALL :Fib %B% D CALL :Fib %C% E :FibRet ENDLOCAL & SET /A %2=%D%+%E% & GOTO :EOF输出是“Fib(10)=89”您还可能感兴趣的日志:强大的批处理 (3) 判断目录在%Path%中强大的批处理 (4) 使用数组强大的批处理 (1) 字符串截取 Leave a Reply Cancel reply Name (required) E-mail (required) URI Your CommentYou may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>