aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp')
-rw-r--r--CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp b/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp
index beb37f6..00ef3ff 100644
--- a/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp
+++ b/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.cpp
@@ -17,7 +17,8 @@
* 8) Step into one more time.
* 9) Why did the address of age and value change?
* The address changed becasue we re-instantiated the variable age in the function,
-* but we didn't specify a number for it so it's just filled wiht garbage
+* so it is basically a completely different variable, but we didn't specify a number
+* for it so it's just filled with garbage
* 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.
@@ -40,7 +41,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's not greyed out. I followed every step but its not greyed out for me
+* age is not within the scope of CalcDays.
* 6) Stop debugging.
*
* Debugging Exercise 3
@@ -71,7 +72,8 @@ using std::cout;
using std::cin;
using std::endl;
-int age = 0;
+
+
const int DAYS_PER_YEAR = 365;
@@ -81,12 +83,13 @@ void PrintResults(int age, int days);
int main()
{
-
+ int age = 0;
int days = 0;
+
// Breakpoint 1
// Put breakpoint on the following line
- GetAge();
+ age = GetAge();
days = CalcDays(age);
// Breakpoint 2
@@ -97,7 +100,7 @@ int main()
}
int GetAge()
{
-
+ int age;
cout << "Please enter your age: ";
cin >> age;