aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwardFine <[email protected]>2022-10-20 14:15:30 -0700
committerEdwardFine <[email protected]>2022-10-20 14:15:30 -0700
commit11f91fdf2fb79af3baafdfb4e6430c123b32fa66 (patch)
treeb92d29641f70766b2bcd44f1965d8dda7170a473
parentrename (diff)
downloadcst116-ch10-debugging-edwardfine-main.tar.xz
cst116-ch10-debugging-edwardfine-main.zip
Finished CodeHEADmain
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging-EdwardFine.cpp31
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj3
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters2
3 files changed, 28 insertions, 8 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging-EdwardFine.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-EdwardFine.cpp
index 21f2790..27d92ec 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging-EdwardFine.cpp
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-EdwardFine.cpp
@@ -1,5 +1,5 @@
/********************************************************************
-* File: CST116-Ch10-Debugging.cpp
+* File: CST116-Ch10-Debugging-EdwardFine.cpp
*
* General Instructions: Complete each step before proceeding to the
* next.
@@ -20,9 +20,11 @@
* symbol. Notice how a multidimensional array is shown in the
* debugger, the null terminating characters location, and how a
* character is represented within each element of the array.
+* 0x000000e88a58fac8 "Edward", 0x000000e88a58fadc "Fine"}
* 8) Continue running the program to Breakpoint 3.
* 9) Notice the contents of varX and varY now that you are back in the
* main function.
+* varX has 0 1 2 3 4 and varY has 100 101 102 103 104
* 10) Clear all the breakpoints.
* 11) Stop debugging.
*
@@ -41,9 +43,24 @@
* flow returns back to main.
* 6) Make sure your Watch window is visible and notice the contents
* of varY and varZ now that you are back in main.
+* varY has the same values and more counted from last time: 100 101 102 103 104 105 106 107 108 109, but we haven't assigned any values to varZ yet so
+* there is still just 10 placeholder numbers.
* 7) Stop debugging.
* 8) Disable all breakpoints.
* 9) Rebuild and execute the program and verify the results.
+* x y z
+
+ 0 100 100
+ 1 101 102
+ 2 102 104
+ 3 103 106
+ 4 104 108
+ 5 105 110
+ 6 106 112
+ 7 107 114
+ 8 108 116
+ 9 109 118
+ Results are accurate when adding the two variables together.
*
* Debugging Exercise 3
*
@@ -80,15 +97,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 +117,7 @@ int main()
// Breakpoint 3
// Put breakpoint on the following line
FunctionTwo(varX, varY, varZ);
+ varZ[0] = -99;
PrintFunction(varX, varY, varZ);
return 0;
@@ -126,11 +144,12 @@ 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 < 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[])
{
+ varX[1] = 99;
for (int x = 0; x < SIZE; x++) // Notice the const SIZE here
varZ[x] = varX[x] + varY[x];
}
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj
index 35e9b1e..2f4c370 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj
@@ -24,6 +24,7 @@
<ProjectGuid>{25de9f3e-d136-4e74-afd8-995bd672d9c4}</ProjectGuid>
<RootNamespace>CST116Ch10Debugging</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ <ProjectName>CST116-Ch10-Debugging-EdwardFine</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -127,7 +128,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="CST116-Ch10-Debugging.cpp" />
+ <ClCompile Include="CST116-Ch10-Debugging-EdwardFine.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters
index dc0ce4a..e80e643 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters
@@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="CST116-Ch10-Debugging.cpp">
+ <ClCompile Include="CST116-Ch10-Debugging-EdwardFine.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>