From 1588c3a76d84c667d38a10e471cca79416f78e73 Mon Sep 17 00:00:00 2001 From: Anibal LopezBonilla Date: Thu, 6 Oct 2022 19:06:40 -0700 Subject: Push 2 --- CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp') diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index cf110a7..09c01a4 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -29,8 +29,13 @@ * 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? +* +* ANS: There is if statement to take into account for the ages of 21 and up. +* * 7) Fix the problem and repeat Steps 1 – 5 to verify the * problem was corrected. +* +* * 8) Stop debugging. * 9) Remove Breakpoint1. * @@ -61,7 +66,7 @@ int main() // Put a breakpoint on the following line 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; -- cgit v1.2.3