下面是我给小孩子做的一个练习,在windows下LZ能实现吗
code:
@echo off
setlocal enabledelayedexpansion&title 加减混和
set d="错啦^! 请再来一遍^!"
set g=12345689abcde
set h=20
set i=3
set j= 再 见
set k= ^+^-
set e=真棒, 得了两次满分
:allbegin
set allw=0
set allr=0
:more
if !allr!==2 goto end
set /a allr=%allr%+1
:start
cls
mode con cols=18 lines=3
set all=0
set right=0
set wrong=0
echo.
:begin
color 1e
set /a a=%random%%%10+1
set /a b=%random%%%10+1
set /a l=%random%%%2+1
set m=!k:~%l%,1!
set /a c=!a!!m!!b!
if !m!==^+ goto add
if !b! gtr !a! goto begin
:again
if !all!==30 goto ok
set /a all=%all%+1
set /p answer= !a!-!b!^=
if !answer! equ !c! echo ~~ 你好棒 (!all!)&set /a right=%right%+1&goto begin
color fc
::echo %d%
set/p= !d:~1,10!<nul
set /a wrong=%wrong%+1
goto again
:add
if !all!==30 goto ok
set /a all=%all%+1
set /p ans= !a!+!b!^=
if !ans! equ !c! echo ~~ 你好棒 (!all!)&set /a right=%right%+1&goto begin
color fc
::echo %d%
set/p= !d:~1,10!<nul
set /a wrong=%wrong%+1
goto add
:ok
cls
mode con cols=31 lines=7
echo.
set /a df=!right!*100/!all!
echo 你一共做了!all!道题
echo 做对了 !right!道题
echo 做错了 !wrong!道题
echo 得 !df!分
if !df! equ 100 echo 好极了,不要骄傲喔&pause>nul&goto more
echo 成绩不是很好,再来一次,要努力喔
if !allw!==1 goto allbegin
set /a allw=%allw%+1
pause>nul
goto start
:end
cls
mode con cols=18 lines=3
echo.
set /a f=%random%%%13+1
color !g:~%f%,1!c
set /p=!e!<nul
::ping /n 1 127.1>nul
sleep001 200
if !h!==0 goto out
set /a h=%h%-1
goto end
:out
mshta vbscript:CreateObject("SAPI.SpVoice").Speak("Byebye!")(Window.close)
:aot
cls
color 1e
echo.
set /p=!j!<nul
::ping /n 2 127.1>nul
sleep001 1000
if !i!==0 goto bye
set /a i=%i%-1
goto aot
:bye
exit