diff options
| author | Trenton Stark <[email protected]> | 2022-10-12 21:03:39 -0700 |
|---|---|---|
| committer | Trenton Stark <[email protected]> | 2022-10-12 21:03:39 -0700 |
| commit | 5b1a1d40fe7cdaed217a8b6e9db89c8c04bee32a (patch) | |
| tree | 71a02862101e3f048727e02898dc04a111170bc2 /CST116-Ch7-Debugging | |
| parent | completed exercise 2 (diff) | |
| download | cst116-ch7-debugging-stark-5b1a1d40fe7cdaed217a8b6e9db89c8c04bee32a.tar.xz cst116-ch7-debugging-stark-5b1a1d40fe7cdaed217a8b6e9db89c8c04bee32a.zip | |
completed excercise 3
Diffstat (limited to 'CST116-Ch7-Debugging')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index 538fb8d..63899d2 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -38,9 +38,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"?
+* Child is being printed correctly, adult is being printed because it is not being considered as a part of the else if statement
* 4) Re-run the program this time with debugging and run to
* Breakpoint 2.
* 5) Why is the action with the else executing?
+* The semicolon is seperating the else statement from the cout
* 6) Fix the problem and re-run to verify the problem was corrected.
********************************************************************/
@@ -68,7 +70,7 @@ int main() cout << "Senior" << endl;
// Breakpoint 2
// Put a breakpoint on the following line
- else;
+ else
cout << "Adult" << endl;
return 0;
|