From 033d2f863492d17d6672bc7f26fe8d6d05ee7c18 Mon Sep 17 00:00:00 2001 From: Morgan Cyrus Date: Wed, 12 Oct 2022 20:30:41 -0700 Subject: Fixed Teenager age --- CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 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 fe6e040..fd2299a 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -1,6 +1,8 @@ /******************************************************************** -* File: CST116-Ch7-Debugging.cpp +* File: CST116-Ch7-Cyrus.cpp * +* +* * General Instructions: Complete each step before proceeding to the * next. * @@ -35,12 +37,24 @@ * Debugging Exercise 2 * * 1) Run to Breakpoint 1. +* done +* * 2) When prompted, enter the value 25 for your age. +* done +* * 3) Step over the if statement. Execution of the program should * continue on the else if statement. +* done +* * 4) Verify that 25 is still stored in age. +* verified +* * 5) Step over the else if. +* done +* * 6) Why is the program going to print "Teenager" for an age of 25? +* || is OR not && AND +* * 7) Fix the problem and repeat Steps 1 – 5 to verify the * problem was corrected. * 8) Stop debugging. @@ -73,7 +87,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