I was making a program to loop a certain formula until the two values are equal. So I made it a do while loop and the final x destination increases by 1 every failed attempt.I thought this in essence would cause it to stop at the exact time that a has a chance to be not less than c.But what it does is it keeps going. at 83 it works, both display 332, but at 174(next lvl) a=1031 and c=696...those two have to equal for my program to function properly...any help please (I made tons of variables for my program not all are used, I usually just make a few extra ahead of time) the code is posted below.
Code:Private Sub Command1_Click()
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Single
Dim e As Long
Dim f As Long
Dim x As Single
b = Text1.Text
c = b * 4
d = 1
Do while e < c
For x = 1 To d
a = a + Int(x + 300 * (2 ^ (x / 7)))
e = Fix(a)
d = d + 1
Next x
Loop
Label1.Caption = "a=" & a
Label2.Caption = "b=" & b
Label3.Caption = "c=" & c
Label4.Caption = "d=" & d
Label5.Caption = "e=" & e
Label6.Caption = "f=" & f
Label7.Caption = "x=" & x
End Sub
