From e560d475a438f1fd4b5f9977e96a9145e350a4f8 Mon Sep 17 00:00:00 2001 From: Musa Ahmed Date: Wed, 19 Oct 2022 16:55:25 -0700 Subject: Added the pseudocode txt --- .../CST116-Ch9-Debugging-Ahmed.cpp | 15 +++++++++------ .../CST116-Ch9-Debugging-Ahmed.vcxproj | 3 +++ .../CST116-Ch9-Debugging-Ahmed.vcxproj.filters | 5 +++++ .../cst116-ch9-Debugging-Ahmed.txt | 19 +++++++++++++++++++ CST116-Ch9-Debugging-Ahmed/lab1.pdf | Bin 0 -> 147668 bytes 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 CST116-Ch9-Debugging-Ahmed/cst116-ch9-Debugging-Ahmed.txt create mode 100644 CST116-Ch9-Debugging-Ahmed/lab1.pdf 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; diff --git a/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj b/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj index 03b8aa4..4388c12 100644 --- a/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj +++ b/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj @@ -129,6 +129,9 @@ + + + diff --git a/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj.filters b/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj.filters index 08d805a..c2c9dbe 100644 --- a/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj.filters +++ b/CST116-Ch9-Debugging-Ahmed/CST116-Ch9-Debugging-Ahmed.vcxproj.filters @@ -19,4 +19,9 @@ Source Files + + + Source Files + + \ No newline at end of file diff --git a/CST116-Ch9-Debugging-Ahmed/cst116-ch9-Debugging-Ahmed.txt b/CST116-Ch9-Debugging-Ahmed/cst116-ch9-Debugging-Ahmed.txt new file mode 100644 index 0000000..1d80833 --- /dev/null +++ b/CST116-Ch9-Debugging-Ahmed/cst116-ch9-Debugging-Ahmed.txt @@ -0,0 +1,19 @@ +Start Program + +Initialize a constant integer "DAYS_PER_YEAR" to 365 +Initialize a function GetAge() +Initialize a function CalcDays() which passes the age +Initialize a function PrintResults() which passes age and days, both are ints +Initialize the iintegers age and days + +Run the fucntion GetAge() + Prompt the user for their age + Store it into the variable age +Run the function CalcDays(age) + Perform the multiplication of DAYS_PER_YEAR and age + Return the integer days +Store the output from the previous function to the int days +Run th efunction PrintResults(age,days) + print the users age, and tell them how many days old they are + +End Program \ No newline at end of file diff --git a/CST116-Ch9-Debugging-Ahmed/lab1.pdf b/CST116-Ch9-Debugging-Ahmed/lab1.pdf new file mode 100644 index 0000000..56c50e0 Binary files /dev/null and b/CST116-Ch9-Debugging-Ahmed/lab1.pdf differ -- cgit v1.2.3