diff options
| author | Joe Traver <[email protected]> | 2022-10-11 21:06:08 -0700 |
|---|---|---|
| committer | Joe Traver <[email protected]> | 2022-10-11 21:06:08 -0700 |
| commit | 50da6cb736db8f339fffc2cbd73ac5e01551ee4c (patch) | |
| tree | 2227d7ee971426774b274550d7143088a428b0ce /CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | |
| parent | Stumped (diff) | |
| download | cst116-ch7-debugging-joetraver30-50da6cb736db8f339fffc2cbd73ac5e01551ee4c.tar.xz cst116-ch7-debugging-joetraver30-50da6cb736db8f339fffc2cbd73ac5e01551ee4c.zip | |
Answered and made corrections to exersise 1
Diffstat (limited to 'CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index f64adfe..a6a94ba 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -1,5 +1,5 @@ /********************************************************************
-* File: CST116-Ch7-Debugging.cpp
+* File: CST116-Ch7-Debugging-joetraver30.cpp
*
* General Instructions: Complete each step before proceeding to the
* next.
@@ -13,6 +13,9 @@ * the value in age is what you typed in.
* 5) Step over the if statement.
* 6) Why did the value in age change?
+*
+* -The equality operator is = so it makes the variable equal to that instead of == which checks IF the variable is equal to it-
+*
* 7) Fix the problem and repeat Steps 2 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -56,18 +59,23 @@ int main() // Breakpoint 1
// Put a breakpoint on the following line
- if (age = 1)
+
+ if (age == 1)
cout << "First Birthday" << endl;
+
else if (age >= 12 || age <= 19)
cout << "Teenager" << endl;
+
else if (age < 12)
cout << "Child" << endl;
+
else if (age > 62)
cout << "Senior" << endl;
+
// Breakpoint 2
// Put a breakpoint on the following line
- else;
- cout << "Adult" << endl;
-
+ else
+ cout << "Adult" << endl;
+
return 0;
}
\ No newline at end of file |