From d8df6d96473d52fdbc69d0bb3e8da802a5ca9fc3 Mon Sep 17 00:00:00 2001 From: Andrei F Date: Wed, 12 Oct 2022 22:21:50 -0700 Subject: Finished exercise 3 --- CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp index b0552a7..eaa348e 100644 --- a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp +++ b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp @@ -58,6 +58,10 @@ * statement. * 5) Run the program to Breakpoint 2 and verify that the output * displayed on the screen is 0 � 9. + * + * Yes, if I add another breakpoint after the while loop block and run it in debug mode and check the console, + * the outputs are 0 to 9. However, the variable i is equal to 10, which makes sense because that is how it + * got out of the while loop block. * * Debugging Exercise 4 * @@ -75,13 +79,13 @@ using std::endl; int main() { - int i = -1; + int i = 0; int count; // Breakpoint 1 // Put a breakpoint on the following line - while (i < 0) - cout << i << endl; + while (i < 10) + cout << i++ << endl; // Breakpoint 2 -- cgit v1.2.3