diff options
Diffstat (limited to 'CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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 |