I'm new to this forum and I have a problem I can't seem to find the answer to anywhere. I have the following loop in a program for school and when I run it I get infinite outputs. The conditions for the internal if structures don't seem to be working correctly. Any help would be appreciated. The output looks like this:
test2
test
here3
test2
test
here3
test2
test
here3
test2
test
here3
test2
test
here3
test2
test
here3
test2
test
here3
test2
test
here3
test2...
Oh wow thank you. I can't believe that's what was causing it. length is assigned from the length of a vector and prevNumb is instantiated outside of the loop. changing the condition to == did the trick.