aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp')
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index aa48b0c..bb7ed08 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -52,7 +52,15 @@
* 4) Re-run the program this time with debugging and run to
* Breakpoint 2.
* 5) Why is the action with the else executing?
+ *
+ * The action code inside the else block is executing because of the semicolon on the end of the "else",
+ * while I don't know why, I am assuming its because the ( compiler ? ) is assuming it's the end of a line and its
+ * automatically entering the block. Removing that semicolon will ensure that it won't execute.
+ *
* 6) Fix the problem and re-run to verify the problem was corrected.
+ *
+ * If I input the age 19 now, it will correctly output Teenager.
+ *
********************************************************************/
#include <iostream>
@@ -85,7 +93,7 @@ int main()
// Breakpoint 2
// Put a breakpoint on the following line
- else;
+ else
{
cout << "Adult" << endl;
}