diff options
| author | Andrei F <[email protected]> | 2022-10-12 21:50:18 -0700 |
|---|---|---|
| committer | Andrei F <[email protected]> | 2022-10-12 21:50:18 -0700 |
| commit | 634dca05ca695c127c1dd80aabec7d29eb489bf7 (patch) | |
| tree | 9b44604007860e7e5f015ebc9c439e4fa92acf9b /CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | |
| parent | Finished Exercise 1 (diff) | |
| download | cst116-ch7-debugging-florea-634dca05ca695c127c1dd80aabec7d29eb489bf7.tar.xz cst116-ch7-debugging-florea-634dca05ca695c127c1dd80aabec7d29eb489bf7.zip | |
Finished exercise 2
Diffstat (limited to 'CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp')
| -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.
|