1. Change your program to something more manageable, like 3 or 4 months.
2. Step through it manually, making note of what you think the values of relevant variables will be at various points, which code paths will be followed for if statements, how many times a loop will execute and what will happen/change each time through, etc.
3. Add a bunch of print statements so that running the program will print out what's actually happening with regards to the above. (Or use a debugger if you're comfortable with one.)
4. Compare your expected output with the actual output. Where they differ, you've narrowed down the source of a problem.
5. Try to figure out why that difference arose. Validate or disprove your own assumptions.
6. If you can't figure it out, or if you don't see a difference, you need to look somewhere else. Go back to step 2, and reevaluate what "relevant" means.
It may seem like a long and tedious process, but in the vast majority of cases, it's faster and more effective than just guessing. Skilled professionals do it this way too. The really skilled ones start with something manageable before they go for the full-blown thing, and write code to test their real code before they write their real code.
And of course, if you get to where you really can't make any more progress, post again, showing what you've done, what output you got, and what output you expected. (I didn't see that last one in your most recent post.)
I still don't understand what your question is. You desire output that is different from what you are getting, but you haven't explained what it is you want, and you haven't really shown the output you do get. How about starting with a clear explanation of that the program is meant to do?
get schwifty. tiny ad:
how do I do my own kindle-like thing - without amazon