© Will Briggs 2019
Will BriggsC++ for Lazy Programmershttps://doi.org/10.1007/978-1-4842-5187-4_9

9. Using the Debugger

Will Briggs
(1)
Lynchburg, VA, USA
 
The debugger lets you step through the program, line by line or function by function, seeing the values of variables so you can tell what goes wrong. Good idea, right?
I think so.

A flawed programA477913_1_En_9_Figa_HTML.gif

To cover useful debugger commands, let’s use the debugger to repair the flawed program in Example 9-1. It’s intended to draw a US flag: a sort of a groovy, hand-made looking version with hollow stars as in the picture. (To do a better job, we’d use an image from a file – but for now I want to use, and debug, ...

Get C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.