From 5b1a1d40fe7cdaed217a8b6e9db89c8c04bee32a Mon Sep 17 00:00:00 2001 From: Trenton Stark Date: Wed, 12 Oct 2022 21:03:39 -0700 Subject: completed excercise 3 --- CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index 538fb8d..63899d2 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -38,9 +38,11 @@ * 1) Run the program without debugging. * 2) When prompted, enter the value of 10 for your age. * 3) Why does the program print both "Child" and "Adult"? +* Child is being printed correctly, adult is being printed because it is not being considered as a part of the else if statement * 4) Re-run the program this time with debugging and run to * Breakpoint 2. * 5) Why is the action with the else executing? +* The semicolon is seperating the else statement from the cout * 6) Fix the problem and re-run to verify the problem was corrected. ********************************************************************/ @@ -68,7 +70,7 @@ int main() cout << "Senior" << endl; // Breakpoint 2 // Put a breakpoint on the following line - else; + else cout << "Adult" << endl; return 0; -- cgit v1.2.3