First:
always use code-tags (the little # in the forums-editor), if you post code.
Second it's definitely a programming issue, at least if you used copy and paste for your code.
By the way, it does not even compile here, but even if this is fixed, there is a simple error in one of your loops.
I think you find it yourself if you double-check them again.
Third: as Tim states that post violates our
forum rules.
Please (re-)read them.
When registering here, you accepted to follow these rules, so please do so.
Thank you!