loading
  1. Create a new text file
  2. Save it as ".bat"
  3. Copy code into batch file

CODE:

echo off
title Math quiz color 09 mode con cols=60 mode con lines=30 setlocal ENABLEDELAYEDEXPANSION set q=0 set g=0 goto cop

:cop cls echo. echo. echo 1) level 1 echo 2) level 2 echo 3) level 3 echo 4) level 4 echo 5) level 5 echo 6) level 6 choice /c 123456 >> nul if %errorlevel%==1 set pass=1 if %errorlevel%==2 set pass=2 if %errorlevel%==3 set pass=3 if %errorlevel%==4 set pass=4 if %errorlevel%==5 set pass=5 if %errorlevel%==6 set pass=6 goto %pass%

:1 set /a q+=1 if %q%==11 goto done set pass=1 set /a a=%random% %%!5 +1 set /a b=%random% %%!5 +1 goto start

:2 set /a q+=1 if %q%==11 goto done set pass=2 set /a a=%random% %%!10 +1 set /a b=%random% %%!10 +1 goto start

:3 set /a q+=1 if %q%==11 goto done set pass=3 set /a a=%random% %%!10 +1 set /a b=%random% %%!20 +1 goto start

:4 set /a q+=1 if %q%==11 goto done set pass=4 set /a a=%random% %%!100 +1 set /a b=%random% %%!100 +1 goto start

:5 set /a q+=1 if %q%==11 goto done set pass=5 set /a a=%random% %%!1000 +1 set /a b=%random% %%!1000 +1 goto start

:6 set /a q+=1 if %q%==11 goto done set pass=6 set /a a=%random% %%!1000000 +1 set /a b=%random% %%!1000000 +1 goto start

:start color 79 set /a c=%a% + %b% cls echo. echo. echo What is %a% + %b% echo. set /p d=Answer: if %d%==%c% goto right if not %d%==%c% goto wrong

:right set /a g+=1 cls color 02 echo. echo. echo Right! timeout /t 1 /nobreak>nul goto %pass%

:wrong cls color 04 echo. echo. echo Wrong! timeout /t 1 /nobreak>nul goto %pass%

:done set q=10 color 07 cls echo. echo. echo You got %g% out of %q% right. timeout /t 4 /nobreak>nul if %g% lss 7 goto F if %g% geq 7 goto A

:A color 0b cls echo. echo. echo You Passed! timeout /t 3 /nobreak >> nul exit

:F color 04 cls echo. echo. echo You failed... timeout /t 3 /nobreak >> nul exit

<p>not very good, try to improve it, please!</p>
<p>Do you have any suggestions? If there were any errors please tell me. My code uses the timeout command and that only works on windows 8 and higher. </p>
<p>i guess you could lesson the code. also, help me with the &quot;goto was unexpected command at this time&quot; error.</p>
<p>Sorry, I forgot to update this with my new version. I had this outdated.</p>
<p>Where do you have the goto error? After the math level option? I can try my best to lessen the code.</p>
<p>This is cool! Thanks for sharing.</p>
<p>Thanks for sharing!</p>

About This Instructable

459views

10favorites

Bio: I'm kid that bumped into batch file coding and made lots of effort to learn every thing to make text based games, at least ... More »
More by Mr_ MikaS:Argario server list How to make an Agario server (with command list) Pet wars 
Add instructable to: