diff options
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index 2fc1f9e..4dd5591 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -59,7 +59,7 @@ int main() // Put a breakpoint on the following line
if (age == 1) //made this an equality statement rather than making age equal to 1.
cout << "First Birthday" << endl;
- else if (age >= 12 || age <= 19)
+ else if (age >= 12 && age <= 19) //Exersize 2 with an age of 25 is still writing 'teenager' with this else if. The issue is || is an OR statement. We need an AND statement.
cout << "Teenager" << endl;
else if (age < 12)
cout << "Child" << endl;
|