diff options
| author | prestonderek <[email protected]> | 2022-10-12 14:04:42 -0700 |
|---|---|---|
| committer | prestonderek <[email protected]> | 2022-10-12 14:04:42 -0700 |
| commit | 2492a7ea12b7ed5bebeadff276adba63478d3ddf (patch) | |
| tree | bb269a67c98332ba7d4b6878e8074a7828495402 | |
| parent | Commit agian for exersize 1 complete (diff) | |
| download | cst116-ch7-debugging-prestonderek-2492a7ea12b7ed5bebeadff276adba63478d3ddf.tar.xz cst116-ch7-debugging-prestonderek-2492a7ea12b7ed5bebeadff276adba63478d3ddf.zip | |
Changed OR to AND statement.
| -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;
|