From fb73b167f4b59d92c8d4214220b59d6afc5fd2cf Mon Sep 17 00:00:00 2001 From: Joe Traver Date: Tue, 11 Oct 2022 21:45:26 -0700 Subject: made final notations to answers --- 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 4ee6daf..bb29889 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? +* +* -There is a ; after the while statement which ended the line and the loop- +* * 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,6 +27,9 @@ * 1) Run to Breakpoint 1. * 2) Step into the while loop. * 3) Why did the cout not execute? +* +* -i is less then 1 and can not meet the condition to continue the loop- +* * 4) Check the value of i, now check the condition, does the * condition evaluate to true? * 5) Change the "< 0" to a "< 10". @@ -52,9 +58,12 @@ * 4) Step into the loop. * 5) What is the value stored in count now? * -* -0- +* -10- * * 6) Where was 10 assigned to count? +* +* -the ; after the for statement led the count variable to go to 10 without interuption and end the program- +* * 7) Fix the problem and re-run to verify. ********************************************************************/ #include @@ -64,7 +73,7 @@ using std::endl; int main() { int i = 0; - int count = 0; + int count; // Breakpoint 1 // Put a breakpoint on the following line -- cgit v1.2.3