Treat this as a 'newbie' question. The answer might be a debugger, but I haven't had a bug serious enough to use a debugger in four years - one of the benefits of using c++ - so I've forgotten how to use one. I usually just print variables to stdandard output.
I can't believe someone is saying this. If you haven't had the need for a debugger in 4 years, then you must not be doing serious programming! I would take my time and get familar with gdb and ddd. It would take a few days but you would not regret it. If you ever have read the book "Debugging Applications" by John Robbins, you would first learn how to use a debugger before you even touch programming. At work it surprises me how many engineers are actually afraid of using a debugger. When they encounter a problem, they open the code in the editor and trying to guess what the code is doing. Being very fluent in all the different debugging environments (Visual C++, gdb/ddd), I prefer to put breakpoints here and there and step thru it to see whats happening. I would say it again. The time that you spend learning how to use a debugger will never go into waste. Period. Salman