diff options
| author | Andrei F <[email protected]> | 2022-10-12 22:21:50 -0700 |
|---|---|---|
| committer | Andrei F <[email protected]> | 2022-10-12 22:21:50 -0700 |
| commit | d8df6d96473d52fdbc69d0bb3e8da802a5ca9fc3 (patch) | |
| tree | 26746eba59b5d6c31bbcd122b85a3274c36dfdad | |
| parent | Finished exercise 1-2 (diff) | |
| download | cst116-chapter8-debugging-florea-d8df6d96473d52fdbc69d0bb3e8da802a5ca9fc3.tar.xz cst116-chapter8-debugging-florea-d8df6d96473d52fdbc69d0bb3e8da802a5ca9fc3.zip | |
Finished exercise 3
| -rw-r--r-- | CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp | 10 |
1 files 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
|