aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
diff options
context:
space:
mode:
authorTrevor Bouchillon <[email protected]>2022-10-06 18:54:07 -0700
committerTrevor Bouchillon <[email protected]>2022-10-06 18:54:07 -0700
commit63c8702f524014bdc3deaa1c20bd38093f40f0c6 (patch)
tree34fff65ed9b29359e4517108b05d238f5e336ef4 /CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
parentDebug1 question answered. (diff)
downloadcst116-ch7-debugging-daboochillin-63c8702f524014bdc3deaa1c20bd38093f40f0c6.tar.xz
cst116-ch7-debugging-daboochillin-63c8702f524014bdc3deaa1c20bd38093f40f0c6.zip
Debug 1 complete
Diffstat (limited to 'CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp')
-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 064a99e..6fb9e1c 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -34,6 +34,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?
+* ************************************************************************************************************************
+* Because the compare operator is not correct. It needs to be && not ||.
+* ************************************************************************************************************************
* 7) Fix the problem and repeat Steps 1 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -64,9 +67,9 @@ int main()
// Breakpoint 1
// Put a breakpoint on the following line
- if (age = 1)
+ 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)
cout << "Child" << endl;