按键精灵脚本自动出口算题练习
dim a,b
a=InputBox("输入加减法上限")
b = InputBox("输入出题个数")
q=InputBox("是2个数还是3个数相加减")
a=cint(a)
b = cint(b)
q = cint(q)
Delay 500
If q = 2 Then
Call 子程序1()
End If
Call 子程序2()
Sub 子程序1()
Rem 开始
Randomize
x=int(Rnd * (a-1+1)) + 1
y=int(Rnd * (a-1+1)) + 1
f=int(Rnd * (1-0+1)) + 1
If f=1 Then
m="-"
If x-y<0 Then
Goto 开始
End if
Goto 打印1
End If
If f=2 Then
m="+"
If x+y>a Then
Goto 开始
End if
Goto 打印2
End if
Rem 打印1
L=L+1
C = C + 1
Rem 重新1
ge = cstr(c)
ge1="第"+ge+"题"
jia1 = cstr(x)
jia2 = cstr(y)
shi=jia1+m+jia2+"="
t = InputBox(shi, ge1, "")
t = cint(t)
If x - y = t Then
dui = dui + 1
Else MessageBox "错误,请重新回答..."
Goto 重新1
End If
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
Rem 打印2
L=L+1
C = C + 1
Rem 重新2
ge = cstr(c)
ge1="第"+ge+"题"
jia1 = cstr(x)
jia2 = cstr(y)
shi=jia1+m+jia2+"="
t = InputBox(shi, ge1, "")
t = cint(t)
If x + y = t Then
dui = dui + 1
Else MessageBox "错误,请重新回答..."
Goto 重新2
End If
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
End Sub
Sub 子程序2()
Rem 开始
Randomize
x=int(Rnd * (a-1+1)) + 1
y=int(Rnd * (a-1+1)) + 1
f=int(Rnd * (1-0+1)) + 1
z=int(Rnd * (a-1+1)) + 1
g=int(Rnd * (1-0+1)) + 1
If f=1 Then
If x-y<0 Then
Goto 开始
End if
m="-"
If g=1 Then
g="-"
If x-y-z<0 Then
Goto 开始
End if
Goto 打印1
End If
If g=2 Then
g="+"
If x-y+z>a Then
Goto 开始
End if
Goto 打印2
End if
End If
If f=2 Then
m="+"
End if
If x+y>a Then
Goto 开始
End if
If g=1 Then
g="-"
If x+y-z<0 Then
Goto 开始
End if
Goto 打印3
End If
If g=2 Then
g="+"
If x+y+z>a Then
Goto 开始
End if
Goto 打印4
End if
Rem 打印1
L=L+1
C = C + 1
Rem 重新1
ge = cstr(c)
ge1="第"+ge+"题"
jia1 = cstr(x)
jia2 = cstr(y)
jia3 = cstr(z)
shi=jia1+m+jia2+g+jia3+"="
t = InputBox(shi, ge1, "")
t = cint(t)
If x - y -z= t Then
dui = dui + 1
Else MessageBox "错误,请重新回答..."
Goto 重新1
End If
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
Rem 打印2
L=L+1
C = C + 1
Rem 重新2
ge = cstr(c)
ge1="第"+ge+"题"
jia1 = cstr(x)
jia2 = cstr(y)
jia3 = cstr(z)
shi=jia1+m+jia2+g+jia3+"="
t = InputBox(shi, ge1, "")
t = cint(t)
If x - y +z= t Then
dui = dui + 1
Else MessageBox "错误,请重新回答..."
Goto
重新2
End If
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
Rem 打印3
L=L+1
C = C + 1
Rem 重新3
ge = cstr(c)
ge1="第"+ge+"题"
jia1 = cstr(x)
jia2 = cstr(y)
jia3 = cstr(z)
shi=jia1+m+jia2+g+jia3+"="
t = InputBox(shi, ge1, "")
t = cint(t)
If x + y -z= t Then
dui = dui + 1
Else MessageBox "错误,请重新回答..."
Goto 重新3
End If
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
本脚本为电脑自动出口算题的脚本。
把以下文本复制到按键精灵的源文件里,就可以运行了,口算运算上限自定,出题个数自定,加数减数的个数自定。。。
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
Rem 打印4
L=L+1
C = C + 1
Rem 重新4
ge = cstr(c)
ge1="第"+ge+"题"
jia1 = cstr(x)
jia2 = cstr(y)
jia3 = cstr(z)
shi=jia1+m+jia2+g+jia3+"="
t = InputBox(shi, ge1, "")
t = cint(t)
If x + y +z= t Then
dui = dui + 1
Else MessageBox "错误,请重新回答..."
Goto 重新4
End If
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
Delay 50
If c = b Then
MessageBox "本次答题结束,继续努力哦..."
EndScript
End if
Goto 开始
End Sub