From 87b135cf85f6990cb36831a6fdbec2f78d214bae Mon Sep 17 00:00:00 2001 From: Trevor Bouchillon Date: Mon, 10 Oct 2022 16:31:48 -0700 Subject: Debug 2 half done --- CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (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 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 -- cgit v1.2.3