diff options
| author | jacobdw22 <[email protected]> | 2022-10-05 16:33:07 -0700 |
|---|---|---|
| committer | jacobdw22 <[email protected]> | 2022-10-05 16:33:07 -0700 |
| commit | c70ef1c4e0bd4a42a1081cdf4fffb8214bb32e77 (patch) | |
| tree | 9693f1813dd76037071061d3e1d879d7dad4cce7 | |
| parent | simple changes (diff) | |
| download | cst116-ch7-debugging-jacobdw22-c70ef1c4e0bd4a42a1081cdf4fffb8214bb32e77.tar.xz cst116-ch7-debugging-jacobdw22-c70ef1c4e0bd4a42a1081cdf4fffb8214bb32e77.zip | |
simple changes
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index de19662..174e44d 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -27,6 +27,7 @@ * 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?
+* Because it is using an OR statement, when it needs an AND statement.
* 7) Fix the problem and repeat Steps 1 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -60,7 +61,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;
|