From 2d424932b9de3bcb86ec33a7bd86d6b865a9c7df Mon Sep 17 00:00:00 2001 From: Andrei F Date: Wed, 26 Oct 2022 21:15:02 -0700 Subject: Completed all Debugging Exercises --- .idea/.gitignore | 8 ++++++++ .idea/.name | 1 + .idea/cst116-ch10-debugging-andr3i-f.iml | 2 ++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 19 +++++++++++++++---- 7 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/cst116-ch10-debugging-andr3i-f.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml 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 @@ + + \ 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 @@ + + + + \ 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 @@ + + + + + + + + \ 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 @@ + + + + + + \ 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 #include @@ -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]; } -- cgit v1.2.3