减法不出现负数
除法不出现小数。
:- @echo off&setlocal EnableDelayedExpansion
- ::题目数,可以自已设置
- set nnn=20
- :: 乘除
- for /l %%a in (1 1 %nnn%) do (
- set /a n1=!random!%%99+1,n2=!random!%%99+1,f=n1%%2
- set f=!f:0=÷!&set f=!f:1=×!
- if "!f!"=="÷" call :cu
- set n1= !n1!&set "n2= !n2!"
- >>乘除.txt echo !n1:~-2! !f! !n2:~-2! =
- )
- :: 加减
- for /l %%a in (1 1 %nnn%) do (
- set /a n1=!random!%%99+1,n2=!random!%%99+1,f=n1%%2
- set f=!f:0=+!&set f=!f:1=-!
- if "!f!"=="-" set /a n2=!random!%%!n1!+1
- set n1= !n1!&set "n2= !n2!"
- >>加减.txt echo !n1:~-2! !f! !n2:~-2! =
- )
- pause&exit
- :cu
- set /a n1=!random!%%50+2,n2=!random!%%98+2,c=n1*n2
- if !c! geq 100 goto cu
- if !c! equ !n2! (set n2=!c!) else (set n1=!c!)
- goto :eof
复制代码
[ 本帖最后由 随风 于 2008-4-7 23:38 编辑 ] |