dim a,b
a=InputBox("输入加减法上限")
b = InputBox("输入出题个数")
q=InputBox("是2个数还是3个数相加减")
a=cint(a)
b = cint(b)
q = cint(q)

call RunApp ("EXCEL.EXE")
Delay 3000

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 打印
End if
If f=2 Then
    m="+"
End if
If x+y>a Then
    Goto 开始
End if
Goto 打印
Rem 打印
SayString x
SayString m
SayString y
SayString "="
KeyPress 9,1
L=L+1
C=C+1
If L=10 Then
    KeyPress 13,1
    L=0
End if
If c=b Then
    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 打印
    End if
    If g=2 Then
        g="+"
        If x-y+z>a Then
            Goto 开始
        End if
        Goto 打印
    End if
End if
If f=2 Then
    m="+"
End if
If x+y>a Then
    Goto 开始
End if
If g=1 Then