diff options
Diffstat (limited to 'CST116-Ch7-Debugging')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 7 |
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.
|