diff options
| author | Andrei F <[email protected]> | 2022-10-26 21:15:02 -0700 |
|---|---|---|
| committer | Andrei F <[email protected]> | 2022-10-26 21:15:02 -0700 |
| commit | 2d424932b9de3bcb86ec33a7bd86d6b865a9c7df (patch) | |
| tree | 08ef7ace5a0cbfc75c764b272722c6e2274d9efb | |
| parent | Added gitignore file (diff) | |
| download | cst116-ch10-debugging-florea-2d424932b9de3bcb86ec33a7bd86d6b865a9c7df.tar.xz cst116-ch10-debugging-florea-2d424932b9de3bcb86ec33a7bd86d6b865a9c7df.zip | |
Completed all Debugging Exercises
| -rw-r--r-- | .idea/.gitignore | 8 | ||||
| -rw-r--r-- | .idea/.name | 1 | ||||
| -rw-r--r-- | .idea/cst116-ch10-debugging-andr3i-f.iml | 2 | ||||
| -rw-r--r-- | .idea/misc.xml | 4 | ||||
| -rw-r--r-- | .idea/modules.xml | 8 | ||||
| -rw-r--r-- | .idea/vcs.xml | 6 | ||||
| -rw-r--r-- | CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 19 |
7 files changed, 44 insertions, 4 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..53b1c01 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +cst116_ch10_debugging_andr3i_f
\ No newline at end of file diff --git a/.idea/cst116-ch10-debugging-andr3i-f.iml b/.idea/cst116-ch10-debugging-andr3i-f.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/cst116-ch10-debugging-andr3i-f.iml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module classpath="CMake" type="CPP_MODULE" version="4" />
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" /> +</project>
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b1c0b8f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/cst116-ch10-debugging-andr3i-f.iml" filepath="$PROJECT_DIR$/.idea/cst116-ch10-debugging-andr3i-f.iml" /> + </modules> + </component> +</project>
\ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>
\ No newline at end of file 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];
}
|