diff options
Diffstat (limited to 'CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp')
| -rw-r--r-- | CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp index 1e3d58b..72e48fd 100644 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp @@ -3,9 +3,7 @@ *
* General Instructions: Complete each step before proceeding to the
* next.
-*
* Debugging Exercise 1
-*
* 1) Build and run the program.
* 2) Examine the code and the output and notice the use of
* parallel arrays.
@@ -15,7 +13,7 @@ * 5) Place a watch on varX, varY and varZ. Click on the '+' in the
* watch window to see the individual elements associated with each
* of the arrays.
-* 6) Continue running your program to Breakpoint 2.
+* 6) Continue running your program to Breakpoint 2
* 7) Add a watch on the array called name. Again, click on the '+'
* symbol. Notice how a multidimensional array is shown in the
* debugger, the null terminating characters location, and how a
@@ -25,17 +23,18 @@ * main function.
* 10) Clear all the breakpoints.
* 11) Stop debugging.
-*
* Debugging Exercise 2
-*
* 1) Change the constant SIZE from 5 to 10.
* 2) Change any literal containing a 5 to the constant SIZE.
* Notice the usefulness of the constant when changes need
* to be made to your code.
+*
* 3) Set a breakpoint at Breakpoint 4. Now on this breakpoint
* set the necessary condition so the loop breaks when x hits 8.
* (Hint: If you need help setting breakpoints based upon a
* condition refer to Chapter 8).
+*
+*
* 4) Run to Breakpoint 4.
* 5) Continue stepping into the remainder of the for loop until the
* flow returns back to main.
@@ -84,11 +83,11 @@ void FunctionTwo(const int varX[], const int varY[], int varZ[]); void PrintFunction(const int varX[], const int varY[],
const int varZ[]);
-const int SIZE = 5;
+const int SIZE = 10;
int main()
{
- int varX[5];
+ int varX[10];
int varY[SIZE];
int varZ[SIZE]; // Notice how we used the const here!
@@ -126,7 +125,7 @@ void FunctionOne(int varX[], int varY[]) // Put breakpoint on the following line
varX[x] = x;
- for (int x = 0; x < 5; x++)
+ for (int x = 0; x < 10; x++)
varY[x] = x + 100;
}
void FunctionTwo(const int varX[], const int varY[], int varZ[])
|