Sounds wierd. I can't see anything wrong.
You are initializing l2TotalTries to zero, right?
What the...Ok, that is what I get for coding at 2 in the morning I guess.
I saw that last night and said "ahh, that's the issue, DUH!" Though after I fixed that I could of swore I tried it again on both my Universities linux machine and my Windows machine with gcc and it still gave the wrong output. Though after doing that again today, setting l2TotalTries to zero works, as it should, and not initializing it to zero doesn't work.
Which I do sort of understand. l2TotalTries would be just garbage data, correct? So I can either get the desired results, or the wrong results. It seems using Visual Studio in both release and debug mode gives me the desired results when it is not set to zero. My friends Mac Book Pro did the same thing. While my University machines just used garbage data, and compiled under GCC on my Windows computer also resulted it in it being set to garbage data.
Little odd that different versions of compilers and different systems did different things to that variable. Though I understand that is not covered in the standard so the results are unknown. Guess I see why you always initialize your variables. Though I still swear that I tried that last night and it still gave unexpected results. Though I can't repeat it today.
I guess lets just ignore this post now. I do feel pretty dumb for making a mistake like that now and not understanding it. *embarrassed*