diff options
Diffstat (limited to 'CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp')
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp index 33af312..f3d67a8 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -20,7 +20,7 @@ * 8) Step into one more time.
* 9) Why did the address of age and value change?
*
-* Looks like a new instance of a variable named "age" was created with "int age;". This new variable would have a new address and deault value.
+* Looks like a new declaration of a variable named "age" was created with "int age;". This new variable would have a new address and deault value.
*
* 10) Step over the cout and cin statements.
* 11) Verify the value entered is stored properly in age.
@@ -31,6 +31,9 @@ * because the new instance of "age" is a local variable contained with the int GetAge() curly brackets.
*
* 15) Stop debugging and fix the error.
+*
+* I put the delcaration of "age" and "days" at the top
+*
* 16) Run to Breakpoint 1.
* 17) Step over the function call to GetAge.
* 18) Verify that the value entered was returned and stored
@@ -45,6 +48,9 @@ * 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 not greyed out, maybe I already fixed it by moving both variables?
+*
* 6) Stop debugging.
*
* Debugging Exercise 3
@@ -74,13 +80,13 @@ using std::cin; using std::endl;
const int DAYS_PER_YEAR = 365;
+int age;
+int days;
int GetAge();
int CalcDays(int age);
void PrintResults(int age, int days);
-int age;
-int days;
int main()
{
|