From 4084f1652ab41b263efd5c7777ee24e018a2563f Mon Sep 17 00:00:00 2001 From: Taylor Rogers Date: Sat, 8 Oct 2022 14:30:11 -0700 Subject: Answered exercise 2 Q6 --- .vs/cst116-ch7-debugging-Taylorrog/v17/.suo | Bin 24064 -> 25600 bytes .../v17/Browse.VC.db | Bin 15200256 -> 15200256 bytes .vs/slnx.sqlite | Bin 331776 -> 331776 bytes CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 11 +++++++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.vs/cst116-ch7-debugging-Taylorrog/v17/.suo b/.vs/cst116-ch7-debugging-Taylorrog/v17/.suo index 5ec7d3e..592c0de 100644 Binary files a/.vs/cst116-ch7-debugging-Taylorrog/v17/.suo and b/.vs/cst116-ch7-debugging-Taylorrog/v17/.suo differ diff --git a/.vs/cst116-ch7-debugging-Taylorrog/v17/Browse.VC.db b/.vs/cst116-ch7-debugging-Taylorrog/v17/Browse.VC.db index a5ba7d4..bb81059 100644 Binary files a/.vs/cst116-ch7-debugging-Taylorrog/v17/Browse.VC.db and b/.vs/cst116-ch7-debugging-Taylorrog/v17/Browse.VC.db differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index ea07ab0..3de3c9a 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index 8a7d023..10862be 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -29,8 +29,15 @@ * 3) Step over the if statement. Execution of the program should * continue on the else if statement. * 4) Verify that 25 is still stored in age. +* +* Still there +* +* * 5) Step over the else if. * 6) Why is the program going to print "Teenager" for an age of 25? +* +* because the OR operator was used when it should be an AND +* * 7) Fix the problem and repeat Steps 1 – 5 to verify the * problem was corrected. * 8) Stop debugging. @@ -61,9 +68,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