aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch10-Debugging
diff options
context:
space:
mode:
Diffstat (limited to 'CST116-Ch10-Debugging')
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
index 1e3d58b..fd35fc3 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
@@ -1,4 +1,5 @@
/********************************************************************
+ * Andrei Florea - CST 116 - Debugging for chapter 10
* File: CST116-Ch10-Debugging.cpp
*
* General Instructions: Complete each step before proceeding to the
@@ -25,6 +26,8 @@
* main function.
* 10) Clear all the breakpoints.
* 11) Stop debugging.
+ *
+ * Done
*
* Debugging Exercise 2
*
@@ -44,6 +47,8 @@
* 7) Stop debugging.
* 8) Disable all breakpoints.
* 9) Rebuild and execute the program and verify the results.
+ *
+ * Done
*
* Debugging Exercise 3
*
@@ -70,6 +75,8 @@
* 10) Stop debugging.
* 11) Disable all breakpoints.
*
+ * Done
+ *
********************************************************************/
#include <iostream>
#include <iomanip>
@@ -80,15 +87,15 @@ 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[]);
-const int SIZE = 5;
+const int SIZE = 10;
int main()
{
- int varX[5];
+ int varX[SIZE];
int varY[SIZE];
int varZ[SIZE]; // Notice how we used the const here!
@@ -100,6 +107,9 @@ int main()
// Breakpoint 3
// Put breakpoint on the following line
FunctionTwo(varX, varY, varZ);
+
+ varZ[0] = -99;
+
PrintFunction(varX, varY, varZ);
return 0;
@@ -129,8 +139,9 @@ void FunctionOne(int varX[], int varY[])
for (int x = 0; x < 5; x++)
varY[x] = x + 100;
}
-void FunctionTwo(const int varX[], const int varY[], int varZ[])
+void FunctionTwo(int varX[], const int varY[], int varZ[])
{
+ varX[1] = 99;
for (int x = 0; x < SIZE; x++) // Notice the const SIZE here
varZ[x] = varX[x] + varY[x];
}