From the course: Debugging in C++ with Visual Studio Code

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Breakpoints

Breakpoints

- [Instructor] Running this program shows that the battery has 20% of its full charge after 24 hours, but that doesn't make sense. That would've happened after 16 hours and in the remaining eight hours it should lose 16% more. So it's time to explore the error again. This time, with the help of the debugger. We are about to use break points, which are special markers we can insert in the code for execution to pause when that point of the program is reached. Once again, we want to inspect the runtime progress of the for loop in the simulate usage function. So that would be in line 19. To insert a break point, you can simply hover over the gutter at the left of the line numbers and you will see red dots show up. Clicking on a red dot will enable a break point at that line. There we have a breakpoint at line 19. Let's run the program. This may be a good time for a reminder. Make sure you see the bug under the play icon in the execution button. That bug indicates execution will be in…

Contents