Code:
std::cout "This is a debug statement showing that variable whatever is: " << whatever << std::endl;
Add these kind of lines in your code to view the status of variables.

The same idea can be applied to checking where your program branches.

If you don't like this approach, figure out how to use a debugger.