diff options
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 |