How to Make a Math Quiz With Batch Files.
by Mr_ MikaS in Circuits > Software
2121 Views, 10 Favorites, 0 Comments
How to Make a Math Quiz With Batch Files.
- Create a new text file
- Save it as ".bat"
- 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