aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
index 042fd0f..143bc87 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
@@ -61,13 +61,25 @@
* 1) Just before the call to the PrintFunction in main, add an
* assignment statement to change the first element in the
* array varZ to -99.
+*
+* Done
+*
* 2) Build and execute your code, verifying that the calculations
* are correct in relation to element 0 of varZ.
+*
+* Done
+*
* 3) Add a line to assign the contents of the second element of
* varX to 99 in FunctionTwo.
+*
+* Done
+*
* 4) Rebuild your program.
* 5 Obviously there is a problem. Remove the const from the
* function declaration and header for varX.
+*
+* Done
+*
* 5) Now you should be able to build and execute your code. Do it.
* 6) Set a breakpoint on Breakpoint 2.
* 7) Re-enable Breakpoint 2.
@@ -80,6 +92,8 @@
* by displaying the new ASCII value too.
* 10) Stop debugging.
* 11) Disable all breakpoints.
+*
+* Done
*
********************************************************************/
#include <iostream>
@@ -91,7 +105,7 @@ using std::setw;
void GetAndDisplayWelcomeInfo();
void FunctionOne(int varX[], int varY[]);
-void FunctionTwo(const int varX[], const int varY[], int varZ[]);
+void FunctionTwo(int varX[], const int varY[], int varZ[]);
void PrintFunction(const int varX[], const int varY[],
const int varZ[]);
@@ -141,10 +155,11 @@ void FunctionOne(int varX[], int varY[])
for (int x = 0; x < SIZE; x++)
varY[x] = x + 100;
}
-void FunctionTwo(const int varX[], const int varY[], int varZ[])
+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];
+ varX[1] = 99;
}
void PrintFunction(const int varX[20], const int varY[20],
const int varZ[20])