diff options
Diffstat (limited to 'CST116-Ch9-Debugging')
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp index eff8980..7f10a3e 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -12,6 +12,7 @@ * 4) Add another watch using &age for the name. This will display
* the address of age.
* 5) Write down the address of age.
+* 0x000000674baffca4 {0}
* 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.
@@ -36,6 +37,7 @@ * 4) Step into one more time so that the current line is the
* calculation.
* 5) Why is age greyed out in your watch window?
+* It is given the alias "years"
* 6) Stop debugging.
*
* Debugging Exercise 3
@@ -47,6 +49,7 @@ * 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?
+* age and days were swapped around.
* 7) Stop debugging and fix the error.
*
* Debugging Exercise 4
@@ -77,7 +80,7 @@ int main() // Breakpoint 1
// Put breakpoint on the following line
- GetAge();
+ age = GetAge();
days = CalcDays(age);
// Breakpoint 2
@@ -103,7 +106,7 @@ int CalcDays(int years) return days;
}
-void PrintResults(int days, int age)
+void PrintResults(int age, int days)
{
cout << age << "! Boy are you old!\n";
cout << "Did you know that you are at least " << days << " days old?\n\n";
|