aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
diff options
context:
space:
mode:
authorAndrei F <[email protected]>2022-10-12 21:54:53 -0700
committerAndrei F <[email protected]>2022-10-12 21:54:53 -0700
commit8d2940adef6d2a4684a3f23b01a92489d0e61684 (patch)
treebd4da799361b6880875a6e06639b88d8c7b895c5 /CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
parentFinished exercise 2 (diff)
downloadcst116-ch7-debugging-florea-8d2940adef6d2a4684a3f23b01a92489d0e61684.tar.xz
cst116-ch7-debugging-florea-8d2940adef6d2a4684a3f23b01a92489d0e61684.zip
Finished exercise 3
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;
}