Hello,
Right now I'm making a program for little kids that will shoot out simple math equations dealing with adding, subtracting, dividing, and multiplying. Everything is working fine except for one small problem on the subtraction part of the program.
I have this function that will create the subtraction problems:
the code in red is supposed to make it so that the last first number of the subtraction equation is not the same as the previous one. But it does not work all the time, because sometimes I get repeats. Can someone help me out to not allow the same equation twice in a row?VB Code:
Public Function GetSubtraction(ByVal low As Integer, ByVal high As Integer) As String intEqCount = intEqCount + 1 [COLOR=Red]Do MainNum = Rand(low, high) Loop Until MainNum <> LastMain[/COLOR] LastMain = MainNum Do DoEvents LowNum = Rand(low, high) Loop Until LowNum < MainNum GetSubtraction = MainNum & " - " & LowNum End Function
thanks




Reply With Quote