BullCowCount.Cows not incrementing up

Hi All,

I just went through the lesson on debugging and at the end of the lesson my code matches the code from the lesson. However, my game doesn’t count Cows. I’ve tried using the debugger, but I really can’t figure out what’s going wrong here. Anyone got any ideas?


Cows-main-cpp

Hey,

I am not able to look at the code image in detail right now (will later), but my initial suggestion for debugging, if you are not familiar with break points, is to add a few cout statements inside each if and else blocks identifying where you are, and also displaying the current value of the variables. This will probably help you.

…back to the breakpoints. You can place breakpoints at each of the if and else statements and their closing braces. If you look at the “locals” section on the lower left hand side pane of Visual Studio you can see the value of each variable at that particular break point.

Let me know if any of that helps.

Hi Sam

I’ve tried to type your code in my project, and it counts cows as expected.
Could you please zip and upload the whole solution so we could debug it?
I think the error is in another place

Privacy & Terms