diff options
| author | [email protected] <[email protected]> | 2022-10-22 14:10:30 -0700 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2022-10-22 14:10:30 -0700 |
| commit | eb91a94bcdd23bd19b5d1314637d61018e889373 (patch) | |
| tree | a1e5ee92bda79f21fcd6fe443690d00f9d298413 /CST116-Ch9-Debugging | |
| parent | Should've pushed more, but kinda got caught up in the moment (diff) | |
| download | cst116-ch9-debugging-smith-benjamin-eb91a94bcdd23bd19b5d1314637d61018e889373.tar.xz cst116-ch9-debugging-smith-benjamin-eb91a94bcdd23bd19b5d1314637d61018e889373.zip | |
Diffstat (limited to 'CST116-Ch9-Debugging')
20 files changed, 51 insertions, 2 deletions
diff --git a/CST116-Ch9-Debugging/CST116-CH9-Smith-Pseudo-Code.txt b/CST116-Ch9-Debugging/CST116-CH9-Smith-Pseudo-Code.txt new file mode 100644 index 0000000..1eed71d --- /dev/null +++ b/CST116-Ch9-Debugging/CST116-CH9-Smith-Pseudo-Code.txt @@ -0,0 +1,19 @@ +main() +1) Initialize variables 'age' and 'days' and set them both to 0 +2) Get the user's age using the GetAge function +3) Set the 'days' variable to how many days that would be in 'age' amount of years using the CalcDays function +4) Call the PrintResults function using 'days' and 'age' as the input variables + +GetAge() +1) Initialize the local variable 'age' +2) get the user to input their age +3) Return 'age' + +CalcDays() +1) Initialize local variables 'years' and 'days' having 'years' be the input variable +2) Calculate days to be years * DAYS_PER_YEAR (365) +3) Return days + +PrintResults() +1) Output the user's age +2) Output the user's days oldness
\ No newline at end of file diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp index eff8980..7d1c10c 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -12,15 +12,19 @@ * 4) Add another watch using &age for the name. This will display
* the address of age.
* 5) Write down the address of age.
+* 0x000000d5558ffb04 {0}
+
* 6) Step Into the code for the function GetAge.
* 7) The execution continues to the function header for GetAge.
* 8) Step into one more time.
* 9) Why did the address of age and value change?
+* It changed because it's now referring to the funcion CalcDays() rather than just the variable by itself
* 10) Step over the cout and cin statements.
* 11) Verify the value entered is stored properly in age.
* 12) Step into until the flow returns to main.
* 13) Step over one more time.
* 14) Why didn't the value entered get transferred back to main?
+* Because the value entered was only for the local variable 'age' inside the function rather than the global variable
* 15) Stop debugging and fix the error.
* 16) Run to Breakpoint 1.
* 17) Step over the function call to GetAge.
@@ -36,6 +40,7 @@ * 4) Step into one more time so that the current line is the
* calculation.
* 5) Why is age greyed out in your watch window?
+* For some reason or another, my variable never turned gray. It just stayed red.
* 6) Stop debugging.
*
* Debugging Exercise 3
@@ -47,6 +52,7 @@ * 4) Step into the PrintResults function.
* 5) Age is 7300? Not even Ralph is that old.
* 6) Why did the values for both variables change?
+* The input variables to the PrintResults function has the wrong order of varaibles, thus swapping their valued.
* 7) Stop debugging and fix the error.
*
* Debugging Exercise 4
@@ -77,12 +83,12 @@ int main() // Breakpoint 1
// Put breakpoint on the following line
- GetAge();
+ age = GetAge();
days = CalcDays(age);
// Breakpoint 2
// Put breakpoint on the following line
- PrintResults(age, days);
+ PrintResults(days, age);
return 0;
}
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Smith.txt b/CST116-Ch9-Debugging/CST116-Ch9-Smith.txt new file mode 100644 index 0000000..df4c478 --- /dev/null +++ b/CST116-Ch9-Debugging/CST116-Ch9-Smith.txt @@ -0,0 +1,8 @@ +Please enter your age: 20 +20! Boy are you old! +Did you know that you are at least 7300 days old? + + +C:\Users\cowpi\Source\Repos\cst116-ch9-debugging-Smith-Benjami\CST116-Ch9-Debugging\x64\Debug\CST116-Ch9-Debugging.exe (process 10264) exited with code 0. +To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. +Press any key to close this window . . .
\ No newline at end of file diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.command.1.tlog b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.command.1.tlog Binary files differnew file mode 100644 index 0000000..6a695c6 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.command.1.tlog diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.read.1.tlog b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.read.1.tlog Binary files differnew file mode 100644 index 0000000..adc3fc2 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.read.1.tlog diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.write.1.tlog b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.write.1.tlog Binary files differnew file mode 100644 index 0000000..75d55f7 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CL.write.1.tlog diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CST116-Ch9-Debugging.lastbuildstate b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CST116-Ch9-Debugging.lastbuildstate new file mode 100644 index 0000000..c138518 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/CST116-Ch9-Debugging.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|C:\Users\cowpi\Source\Repos\cst116-ch9-debugging-Smith-Benjami\CST116-Ch9-Debugging\| diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.command.1.tlog b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.command.1.tlog Binary files differnew file mode 100644 index 0000000..a499f96 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.command.1.tlog diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.read.1.tlog b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.read.1.tlog Binary files differnew file mode 100644 index 0000000..26d60d9 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.read.1.tlog diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.write.1.tlog b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.write.1.tlog Binary files differnew file mode 100644 index 0000000..65f9faf --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-C.dbddd78c.tlog/link.write.1.tlog diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.exe b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.exe Binary files differnew file mode 100644 index 0000000..4e436fa --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.exe diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.exe.recipe b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.exe.recipe new file mode 100644 index 0000000..a79f7f7 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.exe.recipe @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project> + <ProjectOutputs> + <ProjectOutput> + <FullPath>C:\Users\cowpi\Source\Repos\cst116-ch9-debugging-Smith-Benjami\CST116-Ch9-Debugging\x64\Debug\CST116-Ch9-Debugging.exe</FullPath> + </ProjectOutput> + </ProjectOutputs> + <ContentFiles /> + <SatelliteDlls /> + <NonRecipeFileRefs /> +</Project>
\ No newline at end of file diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.ilk b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.ilk Binary files differnew file mode 100644 index 0000000..62c4833 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.ilk diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.log b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.log new file mode 100644 index 0000000..abe70d7 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.log @@ -0,0 +1,2 @@ + CST116-Ch9-Debugging.cpp + CST116-Ch9-Debugging.vcxproj -> C:\Users\cowpi\Source\Repos\cst116-ch9-debugging-Smith-Benjami\CST116-Ch9-Debugging\x64\Debug\CST116-Ch9-Debugging.exe diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.obj b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.obj Binary files differnew file mode 100644 index 0000000..1e2651e --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.obj diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.pdb b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.pdb Binary files differnew file mode 100644 index 0000000..431a161 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.pdb diff --git a/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.vcxproj.FileListAbsolute.txt b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..2eb7498 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/CST116-Ch9-Debugging.vcxproj.FileListAbsolute.txt @@ -0,0 +1 @@ +C:\Users\cowpi\source\repos\cst116-ch9-debugging-Smith-Benjami\CST116-Ch9-Debugging\x64\Debug\CST116-Ch9-Debugging.exe diff --git a/CST116-Ch9-Debugging/x64/Debug/cst116-ch9-debugging.obj.enc b/CST116-Ch9-Debugging/x64/Debug/cst116-ch9-debugging.obj.enc Binary files differnew file mode 100644 index 0000000..4b2bd0a --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/cst116-ch9-debugging.obj.enc diff --git a/CST116-Ch9-Debugging/x64/Debug/vc143.idb b/CST116-Ch9-Debugging/x64/Debug/vc143.idb Binary files differnew file mode 100644 index 0000000..6583eb6 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/vc143.idb diff --git a/CST116-Ch9-Debugging/x64/Debug/vc143.pdb b/CST116-Ch9-Debugging/x64/Debug/vc143.pdb Binary files differnew file mode 100644 index 0000000..f71cc90 --- /dev/null +++ b/CST116-Ch9-Debugging/x64/Debug/vc143.pdb |