aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index a6a94ba..d395096 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -29,6 +29,9 @@
* 4) Verify that 25 is still stored in age.
* 5) Step over the else if.
* 6) Why is the program going to print "Teenager" for an age of 25?
+*
+* -The operator is "or" (||) but should be "and" (&&) to require both conditions being met to produce that output-
+*
* 7) Fix the problem and repeat Steps 1 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -63,7 +66,7 @@ int main()
if (age == 1)
cout << "First Birthday" << endl;
- else if (age >= 12 || age <= 19)
+ else if (age >= 12 && age <= 19)
cout << "Teenager" << endl;
else if (age < 12)