From d92ba19721da9144a94bc4d2cb7f6f371fe5e928 Mon Sep 17 00:00:00 2001 From: jacobdw22 Date: Mon, 17 Oct 2022 16:44:54 -0700 Subject: simple changes --- CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 6 ++++-- cst116-ch9-debugging-wilson.txt | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 cst116-ch9-debugging-wilson.txt 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 -- cgit v1.2.3