Debugging is a good and proper way to find logical errors for bigger complex programs. This video shows how you can do debugging in DevC++ IDE for C++ programs. Other IDEs also support debugging with similar steps but with probably few different shortcuts to start Debug, Next Line, Watch, Breakpoint etc.
Timeline
00:00 - Debugging a simple C++ program
14:14 - Debugging a while loop
19:18 - Making Fibonacci sequence and debugging for errors