diff options
| author | Morgan Cyrus <[email protected]> | 2022-10-12 21:26:56 -0700 |
|---|---|---|
| committer | Morgan Cyrus <[email protected]> | 2022-10-12 21:26:56 -0700 |
| commit | fd782133c4f1552c2779d08c8be19b8c95265a36 (patch) | |
| tree | 15eaf32bb8a9254ce4a7f1fbbe359713dd043d73 | |
| parent | Completed exercise 3 (diff) | |
| download | cst116-chapter8-cyrus-fd782133c4f1552c2779d08c8be19b8c95265a36.tar.xz cst116-chapter8-cyrus-fd782133c4f1552c2779d08c8be19b8c95265a36.zip | |
Finished all exercises
| -rw-r--r-- | CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp index a12e0d8..e24d5b8 100644 --- a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp +++ b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp @@ -85,10 +85,18 @@ *
* 1) Run to Breakpoint 2.
* 2) Add a watch to the variable count.
+* done
+*
* 3) Verify that the contents of count is garbage.
* 4) Step into the loop.
* 5) What is the value stored in count now?
+* 10
+*
* 6) Where was 10 assigned to count?
+* 10 was assigned to count in the for statement.
+* count was set to be 0
+* then while count was less than 10 count was incremented by 1 and checked again.
+*
* 7) Fix the problem and re-run to verify.
********************************************************************/
#include <iostream>
@@ -106,10 +114,14 @@ int main() {
cout << i++ << endl;
}
+ cout << i << endl;
// Breakpoint 2
// Put a breakpoint on the following line
- for (count = 0; count < 10; count++);
+ for (count = 0; count < 10; count++)
+ {
+ cout << count << endl;
+ }
cout << count << endl;
return 0;
|