本帖最后由 idwma 于 2021-9-22 14:43 编辑
- @echo off
- echo;1-1 or 1+1
- set /p a=
- echo;%a%|findstr "+">nul 2>nul&&set jia=%a:+= %&&call :jia&&pause&&exit
- echo;%a%|findstr "-">nul 2>nul&&set jian=%a:-= %
- call :jian %a:-= %
- pause
- exit
-
- :jia
- cls
- for %%i in (%jia%) do (
- for /l %%j in (1,1,%%i) do set/a jg+=1
- )
- echo;%jg%
- goto :eof
-
- :jian
- cls
- set jg=%1
- for /l %%j in (1,1,%2) do (
- set /a jg-=1
- )
- echo;%jg%
- goto :eof
复制代码
|