aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei F <[email protected]>2022-10-12 21:50:18 -0700
committerAndrei F <[email protected]>2022-10-12 21:50:18 -0700
commit634dca05ca695c127c1dd80aabec7d29eb489bf7 (patch)
tree9b44604007860e7e5f015ebc9c439e4fa92acf9b
parentFinished Exercise 1 (diff)
downloadcst116-ch7-debugging-florea-634dca05ca695c127c1dd80aabec7d29eb489bf7.tar.xz
cst116-ch7-debugging-florea-634dca05ca695c127c1dd80aabec7d29eb489bf7.zip
Finished exercise 2
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index e2e7bbd..aa48b0c 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -18,7 +18,8 @@
* 6) Why did the value in age change?
*
* The value of age changed because the if comparison were not correctly written, there was only a single = sign,
- * which means that it would assign a value to a variable.
+ * which means that it would assign a value to a variable. Additionally, the brackets to the if statements were
+ * missing and I added them.
*
* 7) Fix the problem and repeat Steps 2 � 5 to verify the
* problem was corrected.
@@ -34,7 +35,9 @@
* 5) Step over the else if.
* 6) Why is the program going to print "Teenager" for an age of 25?
*
- * The problem is that on the fi
+ * The problem is that on the first else if statement, it was using the OR ( || ) comparison, and that means that
+ * any input age is going to be more than 12 OR less than or equal to 19, therefore any age input is going to result
+ * in teenager.
*
* 7) Fix the problem and repeat Steps 1 � 5 to verify the
* problem was corrected.