diff options
| author | Morgan Cyrus <[email protected]> | 2022-10-12 20:30:41 -0700 |
|---|---|---|
| committer | Morgan Cyrus <[email protected]> | 2022-10-12 20:30:41 -0700 |
| commit | 033d2f863492d17d6672bc7f26fe8d6d05ee7c18 (patch) | |
| tree | dcc2fc28bb9c1b7edbaae260b71bd08feece92a4 /CST116-Ch7-Debugging | |
| parent | Fixed age 1 problem. (diff) | |
| download | cst116-ch7-cyrus-033d2f863492d17d6672bc7f26fe8d6d05ee7c18.tar.xz cst116-ch7-cyrus-033d2f863492d17d6672bc7f26fe8d6d05ee7c18.zip | |
Fixed Teenager age
Diffstat (limited to 'CST116-Ch7-Debugging')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
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;
|