From fd782133c4f1552c2779d08c8be19b8c95265a36 Mon Sep 17 00:00:00 2001 From: Morgan Cyrus Date: Wed, 12 Oct 2022 21:26:56 -0700 Subject: Finished all exercises --- CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp') 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 @@ -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; -- cgit v1.2.3