aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoolyBoi <[email protected]>2022-10-12 18:26:24 -0700
committerDoolyBoi <[email protected]>2022-10-12 18:26:24 -0700
commitd6eda9080a653e9ebe6d913b7de1bccf9b9aeacb (patch)
tree1fd6f3c0d02c4adeebc764812efaeabe5ad0473d
parentfixed issues from debugging exercise 1 and 2 (diff)
downloadcst116-ch7-debugging-abd00l4h-d6eda9080a653e9ebe6d913b7de1bccf9b9aeacb.tar.xz
cst116-ch7-debugging-abd00l4h-d6eda9080a653e9ebe6d913b7de1bccf9b9aeacb.zip
Finished Debugging exercise 3
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp b/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp
index 5ce574f..100454d 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7Debugging-Havaldar.cpp
@@ -39,9 +39,11 @@
* 1) Run the program without debugging.
* 2) When prompted, enter the value of 10 for your age.
* 3) Why does the program print both "Child" and "Adult"?
+* the cout isn't encapsulated in the else statement
* 4) Re-run the program this time with debugging and run to
* Breakpoint 2.
* 5) Why is the action with the else executing?
+* because the action is it's own seperate line and is not part of the else statement
* 6) Fix the problem and re-run to verify the problem was corrected.
********************************************************************/
@@ -69,8 +71,8 @@ int main()
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