diff options
| author | tafaar <[email protected]> | 2022-10-25 12:58:16 -0700 |
|---|---|---|
| committer | tafaar <[email protected]> | 2022-10-25 12:58:16 -0700 |
| commit | 20155f95e794cbc604341ab6dc4febfaa6d8e895 (patch) | |
| tree | f275d97d20f5eac67a69ad325542fa551c1708b3 | |
| parent | backing up to 3.1 (diff) | |
| download | cst116-ch10-debugging-hill-20155f95e794cbc604341ab6dc4febfaa6d8e895.tar.xz cst116-ch10-debugging-hill-20155f95e794cbc604341ab6dc4febfaa6d8e895.zip | |
did exercise 3
| -rw-r--r-- | CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 19 |
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])
|