From ad8be5a37b29265f416d5b1f7a9c468ba20692b0 Mon Sep 17 00:00:00 2001 From: Morgan Cyrus Date: Sun, 30 Oct 2022 12:26:42 -0700 Subject: Finished. --- .../CST116-CH10-pseudo-code-Cyrus.txt | 10 ++++++++++ CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 18 +++++++++++++++++- CST116-Ch10-Debugging/CST116-Text-Cyrus.txt | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 CST116-Ch10-Debugging/CST116-CH10-pseudo-code-Cyrus.txt create mode 100644 CST116-Ch10-Debugging/CST116-Text-Cyrus.txt (limited to 'CST116-Ch10-Debugging') diff --git a/CST116-Ch10-Debugging/CST116-CH10-pseudo-code-Cyrus.txt b/CST116-Ch10-Debugging/CST116-CH10-pseudo-code-Cyrus.txt new file mode 100644 index 0000000..c57c392 --- /dev/null +++ b/CST116-Ch10-Debugging/CST116-CH10-pseudo-code-Cyrus.txt @@ -0,0 +1,10 @@ +Create three arrays with a size of constant SIZE (10) + +get user name, first and last, and display a welcome message and their name +assign the values 0-10 to varX and those same values +100 to varY + +assign varX+varY to varZ for each set of values with special rule to assign the second value of varX to 99 and then do math + +print out 'tab' 'x' 'tab' 'y' 'tab' 'z' and two new lines + +then print the information for each value of the arrays in their appropriate columns \ No newline at end of file diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp index 4aec064..0089338 100644 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp @@ -111,14 +111,22 @@ * done * * 6) Set a breakpoint on Breakpoint 2. +* done +* * 7) Re-enable Breakpoint 2. +* done +* * 8) Run to Breakpoint 2 and make sure you have a watch on the * variable name. +* done +* * 9) Click on the '+'. Once you see all the elements * within the array, change the 'Value' (in the Value field) * for the first element of the array directly within the Watch * window to the character 'Z'. Notice how the value is updated * by displaying the new ASCII value too. +* +* * 10) Stop debugging. * 11) Disable all breakpoints. */ @@ -153,7 +161,7 @@ int main() FunctionTwo(varX, varY, varZ); varZ[0] = -99; - varX[1] = 99; + PrintFunction(varX, varY, varZ); return 0; @@ -186,7 +194,15 @@ void FunctionOne(int varX[], int varY[]) void FunctionTwo(int varX[], const int varY[], int varZ[]) { for (int x = 0; x < SIZE; x++) // Notice the const SIZE here + { varZ[x] = varX[x] + varY[x]; + if (x == 1) + { + varX[1] = 99; + varZ[x] = varX[x] + varY[x]; + } + } + } void PrintFunction(int varX[20], const int varY[20], const int varZ[20]) diff --git a/CST116-Ch10-Debugging/CST116-Text-Cyrus.txt b/CST116-Ch10-Debugging/CST116-Text-Cyrus.txt new file mode 100644 index 0000000..56a9156 --- /dev/null +++ b/CST116-Ch10-Debugging/CST116-Text-Cyrus.txt @@ -0,0 +1,20 @@ +Please enter your first name: Morgan + +Please enter your last name: Cyrus + + + Welcome Morgan Cyrus! + Hope all is well + + x y z + + 0 100 -99 + 99 101 200 + 2 102 104 + 3 103 106 + 4 104 108 + 5 105 110 + 6 106 112 + 7 107 114 + 8 108 116 + 9 109 118 \ No newline at end of file -- cgit v1.2.3