问题是if语句没有改变变量,我不知道为什么。我一直在搞乱它,我找不到办法让它发挥作用。
:Sim
cls
set /a b=(3 * %random%) / 32768 + 1
set /a a=(3 * %random%) / 32768 + 1
::Sets a random number between 1 and 3
if %a% == 1 set %a%=1
if %a% == 2 set %a%=2
if %a% == 3 set %a%=1
if %b% == 1 set %b%=2
if %b% == 2 set %b%=1
if %b% == 3 set %b%=2
::Is supposed to change the variable, but does not :(
echo %a%
echo %a%
:: only echos the random numbers
pause > nul
goto Sim
答案 0 :(得分:0)
想出来只需删除%s