From 21880532a3146105ca7c76810f24f158ff27413e Mon Sep 17 00:00:00 2001 From: Kai Date: Wed, 12 Oct 2022 16:13:33 -0700 Subject: fixed problem 2 --- CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (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 f64adfe..fbfe92a 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -12,7 +12,7 @@ * 4) When the execution stops, add a watch on age and verify that * the value in age is what you typed in. * 5) Step over the if statement. -* 6) Why did the value in age change? +* 6) Why did the value in age change? Because the code is setting it to one rather than checking if it is one. * 7) Fix the problem and repeat Steps 2 – 5 to verify the * problem was corrected. * 8) Stop debugging. @@ -56,9 +56,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; -- cgit v1.2.3