Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::: RC8
- if not defined vers set vers=v8.5.7.84
- ::: SAMPLE USAGE and Function
- ::: set /a base=10 & set /a exponent=5
- ::: set fn="%bats%\exponential_powers.bat"
- ::: call %fn% answer %baseNum% %exponent%
- ::: echo . & echo The Answer for 10\5 is: %answer%.
- ::: echo . & pause & echo .
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :powers <intVar rslt, intVar base, intVar expo>
- setlocal
- set rslt=%~1 & set base=%~2
- set expo=%~3 & set /a answ=1
- for /l %%n in (1, 1, %expo%) do (
- if %answ% gtr 2147483647 pause & break
- if %answ% leq 0 pause & break
- set /a answ*=%base%
- )
- if %answ% gtr 2147483647 (
- goto oops ) else (
- if %answ% leq 0 goto oops )
- :end
- endlocal & set %~1=%answ%
- exit /b %errorlevel%
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :oops
- set answ=That number is out of range.
- goto end
- ::: 100% -JpE-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement