aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index 6663f38..fd649e1 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -68,9 +68,14 @@
* Debugging Exercise 3
*
* 1) Run the program without debugging.
+* done
*
* 2) When prompted, enter the value of 10 for your age.
+* done
+*
* 3) Why does the program print both "Child" and "Adult"?
+* the brackets {} were left out for the if, else if, and else statements.
+*
* 4) Re-run the program this time with debugging and run to
* Breakpoint 2.
* 5) Why is the action with the else executing?
@@ -92,17 +97,27 @@ int main()
// Breakpoint 1
// Put a breakpoint on the following line
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