From d6eda9080a653e9ebe6d913b7de1bccf9b9aeacb Mon Sep 17 00:00:00 2001 From: DoolyBoi Date: Wed, 12 Oct 2022 18:26:24 -0700 Subject: Finished Debugging exercise 3 --- CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp') diff --git a/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp b/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp index 5ce574f..100454d 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp @@ -39,9 +39,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"? +* the cout isn't encapsulated in the else statement * 4) Re-run the program this time with debugging and run to * Breakpoint 2. * 5) Why is the action with the else executing? +* because the action is it's own seperate line and is not part of the else statement * 6) Fix the problem and re-run to verify the problem was corrected. ********************************************************************/ @@ -69,8 +71,8 @@ int main() cout << "Senior" << endl; // Breakpoint 2 // Put a breakpoint on the following line - else; - cout << "Adult" << endl; - + else { + cout << "Adult" << endl; + } return 0; } \ No newline at end of file -- cgit v1.2.3