else的错误
bat吧
全部回复
仅看楼主
level 3
handsome_hell 楼主
如题,(╯‘□′)╯(┻━┻什么错误都没找到......显示此时不应有else
@echo off&setlocal enabledelayedexpansion
set /a all=%random%%%50+5
set /a one=%random%%%5+1
echo 总数=%all%
echo 次数=%one%
set /p player=Who first?(0=computer and 1=human)
if not !player!== 0 (
if not !player!== 1 (
goto :error)
)
echo Start!
set /a now=0,add=!one!+1
if !player!==0 (
set /a win=!all!-1
set /a now0=!win!-!now!
if !now0! lss !one! (
set /a now=!win! )else(
set /a mustwin=!now0!%%!one!
if !mustwin!==0 (
if !now!==!win! (
set now==!all!
goto :cend
)
set /a now+=%random%%%!one!+1
goto :cend)else(
set /a now+=!mustwin!
goto :cend
)
)
:cend
echo computer say:!now!
if !now!==!all! (
echo You win!
)
:error
echo "Sorry,Something worry"&pause>nul
(代码还是半成品)
2014年10月26日 11点10分 1
level 11
else 后面不必加,前面还是要加一下的!
2014年11月03日 14点11分 3
level 1
亲测,前面不用加后面还是要加的[开心]。另外,楼楼的cend前面少了个右括号
2017年10月19日 07点10分 5
1