From 2eeb1893a10d64915e8d144084394e512b6e2fce Mon Sep 17 00:00:00 2001 From: Joe Traver Date: Tue, 11 Oct 2022 20:03:26 -0700 Subject: Completed exersise 3 --- CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp | 7 +++++-- 1 file changed, 5 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 f3a6c6f..a1dd815 100644 --- a/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp +++ b/CST116-Ch8-Debugging/CST116-Ch8-Debugging.cpp @@ -35,6 +35,9 @@ * * 1) Run the program without debugging. * 2) What is happening now is an infinite loop. +* +* -i is less than zero so it will continuously output a zero because the variable value will always be less than 10- +* * 3) End your program by holding down the Ctrl key and pressing C. * 4) Fix the problem by adding a "++" after the i in the cout * statement. @@ -62,8 +65,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