返回列表 发帖
@echo off
setlocal enableDelayedExpansion
set /a A=%random%%%5*9
set /a B=(%random%%%3+1)*3
set fuhao="+-*/"
:calc
set/a n+=1
set/a RS=%A%!fuhao:~%n%,1!%B%
echo %A% !fuhao:~%n%,1! %B% = %RS%
if %n%==4 goto exit
if not "!fuhao:~%n%,1!"=="" goto :calc
pause>nul
goto :eof
:exit
pauseCOPY
这题算是10吗,比之前的for处理容易多了 = =

TOP

@echo off&setlocal enabledelayedexpansion
set/a A=%random%%%5*9
set/a B=(%random%%%3+1)*3
set "fuhao=+-*/"
:calc
set/a RS=A!fuhao:~%n%,1!B
echo %A% !fuhao:~%n%,1! %B% = %RS%
set/a n+=1
if not "!fuhao:~%n%,1!" == "" goto :calc
pause>nul
goto :eofCOPY

TOP

大哥这么厉害,求大哥,帮我解决这个问题吧 http://www.bathome.net/thread-47992-1-1.html

TOP

@echo off
setlocal enabledelayedexpansion
set /a a=%random%%%5*9
echo a=%a%
set /a b=(%random%%%3+1)*3
echo b=%b%
set "fuhao=+-*/"
set /a n=0

:calc
if "!fuhao:~%n%,1!"=="" echo 循环完毕 & pause>NUl & goto :eof
set /a rs=%a%!fuhao:~%n%,1!%b%
echo a !fuhao:~%n%,1! b = !rs!
set /a n+=1
goto :calc
看完大佬的代码自己默写了一遍

TOP

返回列表