aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp
diff options
context:
space:
mode:
authorTrevor Bouchillon <[email protected]>2022-10-10 16:31:48 -0700
committerTrevor Bouchillon <[email protected]>2022-10-10 16:31:48 -0700
commit87b135cf85f6990cb36831a6fdbec2f78d214bae (patch)
tree35cb0806c9debc0d985ab8cfe0dfc88d43c55065 /CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp
parentDebug1 done (diff)
downloadcst116-chapter8-debugging-daboochillin-87b135cf85f6990cb36831a6fdbec2f78d214bae.tar.xz
cst116-chapter8-debugging-daboochillin-87b135cf85f6990cb36831a6fdbec2f78d214bae.zip
Debug 2 half done
Diffstat (limited to 'CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp')
-rw-r--r--CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp
index 53e4a61..37d6a0a 100644
--- a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp
+++ b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp
@@ -14,6 +14,9 @@
* 6) Step over the cout statement.
* 7) Why didn't the flow of the program return back to the while
* statement?
+* ****************************************************************************************
+* The while statement has does not have any outputs.
+* ****************************************************************************************
* 8) Fix this problem by removing the ; after the while statement.
* 9) Stop debugging and repeat Steps 2 � 5 to verify the correction
* worked.
@@ -24,8 +27,14 @@
* 1) Run to Breakpoint 1.
* 2) Step into the while loop.
* 3) Why did the cout not execute?
+* ****************************************************************************************
+* The cout is not part of the while loop
+* ****************************************************************************************
* 4) Check the value of i, now check the condition, does the
* condition evaluate to true?
+* *****************************************************************************************
+* Yes the condutiion evaluates to true.
+* *****************************************************************************************
* 5) Change the "< 0" to a "< 10".
* 6) Stop debugging and repeat Steps 1 � 4 to verify the correction
* worked.
@@ -62,8 +71,8 @@ int main()
// Breakpoint 1
// Put a breakpoint on the following line
- while (i < 0);
- cout << i << endl;
+ while (i < 10)
+ cout << i++ << endl;
// Breakpoint 2
// Put a breakpoint on the following line