口算题函数
利用随机数写个20以内加减法口算题函数
vbscript
Function Kousuan()
Dim intOne As Integer
Dim intTwo As Integer
Dim strFlg As String
Dim intFlg As Integer
Dim strRtn As String
intFlg = Application.WorksheetFunction.RandBetween(0, 1)
strFlg = "-"
If intFlg = 0 Then strFlg = "+"
intOne = Application.WorksheetFunction.RandBetween(10, 20)
intTwo = Application.WorksheetFunction.RandBetween(1, 20)
If strFlg = "-" Then
If intOne > intTwo Then
strRtn = intOne & strFlg & intTwo & "="
Else
strRtn = intTwo & strFlg & intOne & "="
End If
Else
strRtn = intOne & strFlg & intTwo & "="
End If
shuxue = strRtn
End Function