diff options
| author | Anibal LopezBonilla <[email protected]> | 2022-10-06 19:06:40 -0700 |
|---|---|---|
| committer | Anibal LopezBonilla <[email protected]> | 2022-10-06 19:06:40 -0700 |
| commit | 1588c3a76d84c667d38a10e471cca79416f78e73 (patch) | |
| tree | f10af5adee6a26973a236c13c7d16cfd13525635 | |
| parent | Push 1 (diff) | |
| download | cst116-ch7-debugging-lopez-bonilla-1588c3a76d84c667d38a10e471cca79416f78e73.tar.xz cst116-ch7-debugging-lopez-bonilla-1588c3a76d84c667d38a10e471cca79416f78e73.zip | |
Push 2
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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;
|