I suggest using a debugger to step through the code. It will show you exactly where/when the program crashes, as well as you can look at the conditions (values of variables, etc) when it occurs.
David
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
(int A, int B, int C) //A is money, B is coupons, C is candybars
Allow me to stick my nose in here for a peripheral point, but there's one surefire way to make sure that someone reading your code knows what is money, what is coupons, and what is candybars. Name your variables "money","coupons",and "candybars."
Meaningful names for your variables are important, especially when you get to page 110 of a piece of code and your comment about A,B, and C is many pages back.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 583
Skill Endorsements: 11
Haha, you will quickly learn that just because your instructor does it doesn't mean it is right :) I'd follow jonsca's advice on this one.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
It's all good, it was more of a suggestion for the future than anything else anyway.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 583
Skill Endorsements: 11