aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp6
-rw-r--r--cst116-ch9-debugging-wilson.txt3
2 files changed, 7 insertions, 2 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
index a305ab2..58f4164 100644
--- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
+++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
@@ -38,6 +38,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?
+* age is not defined in this scope of the code.
* 6) Stop debugging.
*
* Debugging Exercise 3
@@ -49,6 +50,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?
+* The PrintResults has the variables in the wrong order, and therefore prints them in the wrong order.
* 7) Stop debugging and fix the error.
*
* Debugging Exercise 4
@@ -79,7 +81,7 @@ int main()
// Breakpoint 1
// Put breakpoint on the following line
- GetAge();
+ age = GetAge();
days = CalcDays(age);
// Breakpoint 2
@@ -105,7 +107,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";
diff --git a/cst116-ch9-debugging-wilson.txt b/cst116-ch9-debugging-wilson.txt
new file mode 100644
index 0000000..989c698
--- /dev/null
+++ b/cst116-ch9-debugging-wilson.txt
@@ -0,0 +1,3 @@
+Please enter your age: 18
+18! Boy are you old!
+Did you know that you are at least 6570 days old? \ No newline at end of file