From 55fbb55fd2852027c53c661c79ffb2b2db1f09c9 Mon Sep 17 00:00:00 2001 From: Joseph Williams Date: Thu, 20 Oct 2022 14:38:56 -0700 Subject: finished. --- .gitignore | 5 + .../v17/.suo | Bin 0 -> 14336 bytes .../3c4f46b6-4db1-46f6-8968-44f40e7e7bc2.vsidx | Bin 0 -> 10523 bytes .../47ff5d24-db43-43f8-ac19-aa4b2337c7fa.vsidx | Bin 0 -> 1389 bytes .../908f5140-beb3-4a91-b4ae-7b4b771305b3.vsidx | Bin 0 -> 2612 bytes .../e3246281-8a98-4351-a620-70e5ea86c37a.vsidx | Bin 0 -> 14782 bytes .../FileContentIndex/read.lock | 0 .../.vs/CST116-Ch10-Debugging/v17/.suo | Bin 0 -> 36352 bytes .../.vs/CST116-Ch10-Debugging/v17/Browse.VC.db | Bin 0 -> 16498688 bytes .../.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-shm | Bin 0 -> 32768 bytes .../.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-wal | Bin 0 -> 1388536 bytes .../CST116-CH10-DEBUGGING-WILLIAMS.ipch | Bin 0 -> 40501248 bytes .../e9183a525301575f/CST116-CH10-DEBUGGING.ipch | Bin 0 -> 40501248 bytes .../CST116-Ch10-Debugging-Williams-Pseudocode.txt | 28 ++++ .../CST116-Ch10-Debugging-Williams-Run.txt | 34 +++++ .../CST116-Ch10-Debugging-Williams.cpp | 150 +++++++++++++++++++++ CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 148 -------------------- .../CST116-Ch10-Debugging.vcxproj | 6 +- .../CST116-Ch10-Debugging.vcxproj.filters | 10 +- .../Debug/CST116-C.25de9f3e.tlog/CL.command.1.tlog | Bin 0 -> 2054 bytes .../Debug/CST116-C.25de9f3e.tlog/CL.read.1.tlog | Bin 0 -> 20426 bytes .../Debug/CST116-C.25de9f3e.tlog/CL.write.1.tlog | Bin 0 -> 1020 bytes .../CST116-Ch10-Debugging.lastbuildstate | 2 + .../CST116-C.25de9f3e.tlog/link.command.1.tlog | Bin 0 -> 1928 bytes .../Debug/CST116-C.25de9f3e.tlog/link.read.1.tlog | Bin 0 -> 3992 bytes .../Debug/CST116-C.25de9f3e.tlog/link.write.1.tlog | Bin 0 -> 1086 bytes .../x64/Debug/CST116-Ch10-Debugging-Williams.obj | Bin 0 -> 154357 bytes .../x64/Debug/CST116-Ch10-Debugging.exe | Bin 0 -> 95744 bytes .../x64/Debug/CST116-Ch10-Debugging.exe.recipe | 11 ++ .../x64/Debug/CST116-Ch10-Debugging.ilk | Bin 0 -> 847560 bytes .../x64/Debug/CST116-Ch10-Debugging.log | 2 + .../x64/Debug/CST116-Ch10-Debugging.obj | Bin 0 -> 154324 bytes .../x64/Debug/CST116-Ch10-Debugging.pdb | Bin 0 -> 1470464 bytes ...116-Ch10-Debugging.vcxproj.FileListAbsolute.txt | 1 + CST116-Ch10-Debugging/x64/Debug/vc143.idb | Bin 0 -> 281600 bytes CST116-Ch10-Debugging/x64/Debug/vc143.pdb | Bin 0 -> 471040 bytes 36 files changed, 247 insertions(+), 150 deletions(-) create mode 100644 .gitignore create mode 100644 .vs/cst116-ch10-debugging-AllTheNamesAreTaken3141/v17/.suo create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/3c4f46b6-4db1-46f6-8968-44f40e7e7bc2.vsidx create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/47ff5d24-db43-43f8-ac19-aa4b2337c7fa.vsidx create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/908f5140-beb3-4a91-b4ae-7b4b771305b3.vsidx create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/e3246281-8a98-4351-a620-70e5ea86c37a.vsidx create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/read.lock create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/.suo create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-shm create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-wal create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/a468b4f505a81d66/CST116-CH10-DEBUGGING-WILLIAMS.ipch create mode 100644 CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/e9183a525301575f/CST116-CH10-DEBUGGING.ipch create mode 100644 CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Pseudocode.txt create mode 100644 CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Run.txt create mode 100644 CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams.cpp delete mode 100644 CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.command.1.tlog create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.read.1.tlog create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.write.1.tlog create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CST116-Ch10-Debugging.lastbuildstate create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.command.1.tlog create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.read.1.tlog create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.write.1.tlog create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging-Williams.obj create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe.recipe create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.ilk create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.log create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.obj create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.pdb create mode 100644 CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.vcxproj.FileListAbsolute.txt create mode 100644 CST116-Ch10-Debugging/x64/Debug/vc143.idb create mode 100644 CST116-Ch10-Debugging/x64/Debug/vc143.pdb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a3204dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +*.opendb diff --git a/.vs/cst116-ch10-debugging-AllTheNamesAreTaken3141/v17/.suo b/.vs/cst116-ch10-debugging-AllTheNamesAreTaken3141/v17/.suo new file mode 100644 index 0000000..69ed09c Binary files /dev/null and b/.vs/cst116-ch10-debugging-AllTheNamesAreTaken3141/v17/.suo differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/3c4f46b6-4db1-46f6-8968-44f40e7e7bc2.vsidx b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/3c4f46b6-4db1-46f6-8968-44f40e7e7bc2.vsidx new file mode 100644 index 0000000..5245591 Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/3c4f46b6-4db1-46f6-8968-44f40e7e7bc2.vsidx differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/47ff5d24-db43-43f8-ac19-aa4b2337c7fa.vsidx b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/47ff5d24-db43-43f8-ac19-aa4b2337c7fa.vsidx new file mode 100644 index 0000000..efd5b1b Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/47ff5d24-db43-43f8-ac19-aa4b2337c7fa.vsidx differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/908f5140-beb3-4a91-b4ae-7b4b771305b3.vsidx b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/908f5140-beb3-4a91-b4ae-7b4b771305b3.vsidx new file mode 100644 index 0000000..c435e66 Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/908f5140-beb3-4a91-b4ae-7b4b771305b3.vsidx differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/e3246281-8a98-4351-a620-70e5ea86c37a.vsidx b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/e3246281-8a98-4351-a620-70e5ea86c37a.vsidx new file mode 100644 index 0000000..26b57eb Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/e3246281-8a98-4351-a620-70e5ea86c37a.vsidx differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/read.lock b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/.suo b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/.suo new file mode 100644 index 0000000..8f94258 Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/.suo differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db new file mode 100644 index 0000000..42f31fc Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-shm b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-shm new file mode 100644 index 0000000..f6bec84 Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-shm differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-wal b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-wal new file mode 100644 index 0000000..bc068dc Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/Browse.VC.db-wal differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/a468b4f505a81d66/CST116-CH10-DEBUGGING-WILLIAMS.ipch b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/a468b4f505a81d66/CST116-CH10-DEBUGGING-WILLIAMS.ipch new file mode 100644 index 0000000..d82a99d Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/a468b4f505a81d66/CST116-CH10-DEBUGGING-WILLIAMS.ipch differ diff --git a/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/e9183a525301575f/CST116-CH10-DEBUGGING.ipch b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/e9183a525301575f/CST116-CH10-DEBUGGING.ipch new file mode 100644 index 0000000..b8d8406 Binary files /dev/null and b/CST116-Ch10-Debugging/.vs/CST116-Ch10-Debugging/v17/ipch/AutoPCH/e9183a525301575f/CST116-CH10-DEBUGGING.ipch differ diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Pseudocode.txt b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Pseudocode.txt new file mode 100644 index 0000000..5ee897c --- /dev/null +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Pseudocode.txt @@ -0,0 +1,28 @@ +program start: + +create a constant for SIZE and set it to 10 +create int arrays of size SIZE for varX, varY, and varZ + +run GetAndDisplayWelcomeInfo +run FunctionOne + +run FunctionTwo +set varZ[SIZE-1] to -99 +run PrintFunction + +program end + + +GetandDisplayWelcomeInfo: +create an array NAME containing 2 chars of size 20 +get the user's first and last name and store them in NAME +print a welcome message addressing the user by name + +FunctionOne: +for each value in varX[i], set varY[i] to varX[i] + 100 + +FunctionTwo: +for each value in varX[i], set varZ[i] to varX[i] + varY[i] + +PrintFunction(varX,varY,varZ): +print varX, varY, and varZ in a simple table \ No newline at end of file diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Run.txt b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Run.txt new file mode 100644 index 0000000..9a19982 --- /dev/null +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams-Run.txt @@ -0,0 +1,34 @@ +Please enter your first name: Tim + +Please enter your last name: Timmyson + + + Welcome Tim Timmyson! + Hope all is well + + x y z + + 0 100 100 + 1 101 102 + 2 102 104 + 3 103 106 + 4 104 108 + + +Also I broke your code, do better next time lol: + +Please enter your first name: Glornax + +Please enter your last name: the Destroyer + + + Welcome Glornax the! + Hope all is well + + x y z + + 0 100 100 + 1 101 102 + 2 102 104 + 3 103 106 + 4 104 108 \ No newline at end of file diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams.cpp new file mode 100644 index 0000000..6b34e7b --- /dev/null +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging-Williams.cpp @@ -0,0 +1,150 @@ +/******************************************************************** +* File: CST116-Ch10-Debugging.cpp +* +* 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. +* 3) Insert breakpoints at Breakpoint 1, Breakpoint 2, and Breakpoint +* 3. +* 4) Run to Breakpoint 1. +* 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. +* 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 +* character is represented within each element of the array. +* 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. +* 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. +* 6) Make sure your Watch window is visible and notice the contents +* of varY and varZ now that you are back in main. +* 7) Stop debugging. +* 8) Disable all breakpoints. +* 9) Rebuild and execute the program and verify the results. +* +* Debugging Exercise 3 +* +* 1) Just before the call to the PrintFunction in main, add an +* assignment statement to change the first element in the +* array varZ to -99. +* 2) Build and execute your code, verifying that the calculations +* are correct in relation to element 0 of varZ. +* 3) Add a line to assign the contents of the second element of +* varX to 99 in FunctionTwo. +* 4) Rebuild your program. +* 5 Obviously there is a problem. Remove the const from the +* function declaration and header for varX. +* 5) Now you should be able to build and execute your code. Do it. +* 6) Set a breakpoint on Breakpoint 2. +* 7) Re-enable Breakpoint 2. +* 8) Run to Breakpoint 2 and make sure you have a watch on the +* variable name. +* 9) Click on the '+'. Once you see all the elements +* within the array, change the 'Value' (in the Value field) +* for the first element of the array directly within the Watch +* window to the character 'Z'. Notice how the value is updated +* by displaying the new ASCII value too. +* 10) Stop debugging. +* 11) Disable all breakpoints. +* +********************************************************************/ +#include +#include +using std::cin; +using std::cout; +using std::endl; +using std::setw; + +void GetAndDisplayWelcomeInfo(); +void FunctionOne(int varX[], int varY[]); +void FunctionTwo(int varX[], const int varY[], int varZ[]); +void PrintFunction(const int varX[], const int varY[], + const int varZ[]); + +const int SIZE = 10; + +int main() +{ + int varX[SIZE]; + int varY[SIZE]; + int varZ[SIZE]; // Notice how we used the const here! + + // Breakpoint 1 + // Put breakpoint on the following line + GetAndDisplayWelcomeInfo(); + FunctionOne(varX, varY); + + // Breakpoint 3 + // Put breakpoint on the following line + FunctionTwo(varX, varY, varZ); + varZ[SIZE-1] = -99; + PrintFunction(varX, varY, varZ); + + return 0; +} +void GetAndDisplayWelcomeInfo() +{ + char name[2][20]; // First name in row 0, last name in row 1 + + cout << "Please enter your first name: "; + cin >> name[0]; + + cout << "\nPlease enter your last name: "; + cin >> name[1]; + + // Breakpoint 2 + // Put breakpoint on the following line + cout << "\n\n\tWelcome " << name[0] << " " << name[1] + << "!\n\t Hope all is well \n\n"; +} +void FunctionOne(int varX[], int varY[]) +{ + for (int x = 0; x < SIZE; x++) // NOTICE '<' NOT <= + // Breakpoint 4 + // Put breakpoint on the following line + varX[x] = x; + + for (int x = 0; x < SIZE; x++) + varY[x] = x + 100; +} +void FunctionTwo(int varX[], const int varY[], int varZ[]) +{ + for (int x = 0; x < SIZE; x++) // Notice the const SIZE here + varZ[x] = varX[x] + varY[x]; + varX[1] = 99; +} +void PrintFunction(const int varX[20], const int varY[20], + const int varZ[20]) +{ + int x; + + cout << " \t x \t y \t z\n\n"; + + for (x = 0; x < SIZE; x++) + cout << "\t" << setw(3) << varX[x] + << "\t " << varY[x] + << "\t " << varZ[x] << endl; +} diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp deleted file mode 100644 index 1e3d58b..0000000 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************** -* File: CST116-Ch10-Debugging.cpp -* -* 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. -* 3) Insert breakpoints at Breakpoint 1, Breakpoint 2, and Breakpoint -* 3. -* 4) Run to Breakpoint 1. -* 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. -* 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 -* character is represented within each element of the array. -* 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. -* 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. -* 6) Make sure your Watch window is visible and notice the contents -* of varY and varZ now that you are back in main. -* 7) Stop debugging. -* 8) Disable all breakpoints. -* 9) Rebuild and execute the program and verify the results. -* -* Debugging Exercise 3 -* -* 1) Just before the call to the PrintFunction in main, add an -* assignment statement to change the first element in the -* array varZ to -99. -* 2) Build and execute your code, verifying that the calculations -* are correct in relation to element 0 of varZ. -* 3) Add a line to assign the contents of the second element of -* varX to 99 in FunctionTwo. -* 4) Rebuild your program. -* 5 Obviously there is a problem. Remove the const from the -* function declaration and header for varX. -* 5) Now you should be able to build and execute your code. Do it. -* 6) Set a breakpoint on Breakpoint 2. -* 7) Re-enable Breakpoint 2. -* 8) Run to Breakpoint 2 and make sure you have a watch on the -* variable name. -* 9) Click on the '+'. Once you see all the elements -* within the array, change the 'Value' (in the Value field) -* for the first element of the array directly within the Watch -* window to the character 'Z'. Notice how the value is updated -* by displaying the new ASCII value too. -* 10) Stop debugging. -* 11) Disable all breakpoints. -* -********************************************************************/ -#include -#include -using std::cin; -using std::cout; -using std::endl; -using std::setw; - -void GetAndDisplayWelcomeInfo(); -void FunctionOne(int varX[], int varY[]); -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; - -int main() -{ - int varX[5]; - int varY[SIZE]; - int varZ[SIZE]; // Notice how we used the const here! - - // Breakpoint 1 - // Put breakpoint on the following line - GetAndDisplayWelcomeInfo(); - FunctionOne(varX, varY); - - // Breakpoint 3 - // Put breakpoint on the following line - FunctionTwo(varX, varY, varZ); - PrintFunction(varX, varY, varZ); - - return 0; -} -void GetAndDisplayWelcomeInfo() -{ - char name[2][20]; // First name in row 0, last name in row 1 - - cout << "Please enter your first name: "; - cin >> name[0]; - - cout << "\nPlease enter your last name: "; - cin >> name[1]; - - // Breakpoint 2 - // Put breakpoint on the following line - cout << "\n\n\tWelcome " << name[0] << " " << name[1] - << "!\n\t Hope all is well \n\n"; -} -void FunctionOne(int varX[], int varY[]) -{ - for (int x = 0; x < SIZE; x++) // NOTICE '<' NOT <= - // Breakpoint 4 - // Put breakpoint on the following line - varX[x] = x; - - for (int x = 0; x < 5; x++) - varY[x] = x + 100; -} -void FunctionTwo(const int varX[], const int varY[], int varZ[]) -{ - for (int x = 0; x < SIZE; x++) // Notice the const SIZE here - varZ[x] = varX[x] + varY[x]; -} -void PrintFunction(const int varX[20], const int varY[20], - const int varZ[20]) -{ - int x; - - cout << " \t x \t y \t z\n\n"; - - for (x = 0; x < SIZE; x++) - cout << "\t" << setw(3) << varX[x] - << "\t " << varY[x] - << "\t " << varZ[x] << endl; -} diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj index 35e9b1e..4da25af 100644 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj @@ -127,7 +127,11 @@ - + + + + + diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters index dc0ce4a..149cfa9 100644 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.vcxproj.filters @@ -15,8 +15,16 @@ - + Source Files + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.command.1.tlog b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.command.1.tlog new file mode 100644 index 0000000..0599ba6 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.command.1.tlog differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.read.1.tlog b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.read.1.tlog new file mode 100644 index 0000000..4be6c2e Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.read.1.tlog differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.write.1.tlog b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.write.1.tlog new file mode 100644 index 0000000..7b47a19 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CL.write.1.tlog differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CST116-Ch10-Debugging.lastbuildstate b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CST116-Ch10-Debugging.lastbuildstate new file mode 100644 index 0000000..9b5b9fb --- /dev/null +++ b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/CST116-Ch10-Debugging.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|C:\Users\hey-t\Source\Repos\cst116-ch10-debugging-AllTheNamesAreTaken3141\CST116-Ch10-Debugging\| diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.command.1.tlog b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.command.1.tlog new file mode 100644 index 0000000..2644aa0 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.command.1.tlog differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.read.1.tlog b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.read.1.tlog new file mode 100644 index 0000000..5cf4788 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.read.1.tlog differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.write.1.tlog b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.write.1.tlog new file mode 100644 index 0000000..ee3fcfc Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-C.25de9f3e.tlog/link.write.1.tlog differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging-Williams.obj b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging-Williams.obj new file mode 100644 index 0000000..6ebb2c1 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging-Williams.obj differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe new file mode 100644 index 0000000..3e85b2d Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe.recipe b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe.recipe new file mode 100644 index 0000000..5a27fba --- /dev/null +++ b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.exe.recipe @@ -0,0 +1,11 @@ + + + + + C:\Users\hey-t\Source\Repos\cst116-ch10-debugging-AllTheNamesAreTaken3141\CST116-Ch10-Debugging\x64\Debug\CST116-Ch10-Debugging.exe + + + + + + \ No newline at end of file diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.ilk b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.ilk new file mode 100644 index 0000000..65dc438 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.ilk differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.log b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.log new file mode 100644 index 0000000..b0a0b45 --- /dev/null +++ b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.log @@ -0,0 +1,2 @@ + CST116-Ch10-Debugging-Williams.cpp + CST116-Ch10-Debugging.vcxproj -> C:\Users\hey-t\Source\Repos\cst116-ch10-debugging-AllTheNamesAreTaken3141\CST116-Ch10-Debugging\x64\Debug\CST116-Ch10-Debugging.exe diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.obj b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.obj new file mode 100644 index 0000000..4f58dba Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.obj differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.pdb b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.pdb new file mode 100644 index 0000000..f7f5f5d Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.pdb differ diff --git a/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.vcxproj.FileListAbsolute.txt b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..c2cf464 --- /dev/null +++ b/CST116-Ch10-Debugging/x64/Debug/CST116-Ch10-Debugging.vcxproj.FileListAbsolute.txt @@ -0,0 +1 @@ +C:\Users\hey-t\Source\Repos\cst116-ch10-debugging-AllTheNamesAreTaken3141\CST116-Ch10-Debugging\x64\Debug\CST116-Ch10-Debugging.exe diff --git a/CST116-Ch10-Debugging/x64/Debug/vc143.idb b/CST116-Ch10-Debugging/x64/Debug/vc143.idb new file mode 100644 index 0000000..45a09a2 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/vc143.idb differ diff --git a/CST116-Ch10-Debugging/x64/Debug/vc143.pdb b/CST116-Ch10-Debugging/x64/Debug/vc143.pdb new file mode 100644 index 0000000..2ac0988 Binary files /dev/null and b/CST116-Ch10-Debugging/x64/Debug/vc143.pdb differ -- cgit v1.2.3