diff options
| author | Nathanturcas <[email protected]> | 2022-11-20 22:51:21 -0800 |
|---|---|---|
| committer | Nathanturcas <[email protected]> | 2022-11-20 22:51:21 -0800 |
| commit | 3beddfb410976d57b441a222781c7e8520340374 (patch) | |
| tree | cb2b3ed8ef597f8caf190ab052a08fc1587b99f2 | |
| parent | commit 1 (diff) | |
| download | cst116-ch9-debugging-nathanturcas-main.tar.xz cst116-ch9-debugging-nathanturcas-main.zip | |
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp index eff8980..e5335fc 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -15,12 +15,12 @@ * 6) Step Into the code for the function GetAge.
* 7) The execution continues to the function header for GetAge.
* 8) Step into one more time.
-* 9) Why did the address of age and value change?
+* 9) Why did the address of age and value change? //because the user entered a certain value.
* 10) Step over the cout and cin statements.
* 11) Verify the value entered is stored properly in age.
* 12) Step into until the flow returns to main.
* 13) Step over one more time.
-* 14) Why didn't the value entered get transferred back to main?
+* 14) Why didn't the value entered get transferred back to main? // because it is not stored into a variable.
* 15) Stop debugging and fix the error.
* 16) Run to Breakpoint 1.
* 17) Step over the function call to GetAge.
@@ -35,7 +35,7 @@ * 3) Step into CalcDays.
* 4) Step into one more time so that the current line is the
* calculation.
-* 5) Why is age greyed out in your watch window?
+* 5) Why is age greyed out in your watch window? // because the value of age can't be changed.
* 6) Stop debugging.
*
* Debugging Exercise 3
@@ -46,7 +46,7 @@ * is 7300.
* 4) Step into the PrintResults function.
* 5) Age is 7300? Not even Ralph is that old.
-* 6) Why did the values for both variables change?
+* 6) Why did the values for both variables change? // the order of the age and days presented matters into which way it is written.
* 7) Stop debugging and fix the error.
*
* Debugging Exercise 4
@@ -74,15 +74,16 @@ int main() {
int age = 0;
int days = 0;
-
+
// Breakpoint 1
// Put breakpoint on the following line
- GetAge();
+
+ age = GetAge();
days = CalcDays(age);
// Breakpoint 2
// Put breakpoint on the following line
- PrintResults(age, days);
+ PrintResults(days, age);
return 0;
}
|