aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch7-Debugging
diff options
context:
space:
mode:
authorBold Demchig <[email protected]>2022-10-12 20:54:16 -0700
committerBold Demchig <[email protected]>2022-10-12 20:54:16 -0700
commitf31155764281276463dca9964a68875964dfe432 (patch)
tree2cd60bc54b4a3a2cac2ccc2f27cd72f7f6a9e04e /CST116-Ch7-Debugging
parentSetting up GitHub Classroom Feedback (diff)
downloadcst116-ch7-debugging-batbold74-f31155764281276463dca9964a68875964dfe432.tar.xz
cst116-ch7-debugging-batbold74-f31155764281276463dca9964a68875964dfe432.zip
Hi. I have completed my Ch7 debugging and pushed to GitHub. I have been trying to push it couple times already.
Diffstat (limited to 'CST116-Ch7-Debugging')
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp97
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.command.1.tlogbin0 -> 1002 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.read.1.tlogbin0 -> 19792 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.write.1.tlogbin0 -> 884 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CST116-Ch7-Debugging.lastbuildstate2
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.command.1.tlogbin0 -> 1760 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.read.1.tlogbin0 -> 3670 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.write.1.tlogbin0 -> 956 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exebin0 -> 50688 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe.recipe11
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.ilkbin0 -> 539120 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.objbin0 -> 71768 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.pdbbin0 -> 1806336 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.vcxproj.FileListAbsolute.txt1
-rw-r--r--CST116-Ch7-Debugging/Debug/cst116-ch7-debugging.obj.encbin0 -> 71760 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/vc143.idbbin0 -> 166912 bytes
-rw-r--r--CST116-Ch7-Debugging/Debug/vc143.pdbbin0 -> 405504 bytes
17 files changed, 65 insertions, 46 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index f64adfe..7c50bd8 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -6,68 +6,73 @@
*
* Debugging Exercise 1
*
-* 1) Insert a breakpoint on the lines indicated in the code.
-* 2) Run to Breakpoint 1.
-* 3) When prompted, enter your age.
-* 4) When the execution stops, add a watch on age and verify that
-* the value in age is what you typed in.
-* 5) Step over the if statement.
-* 6) Why did the value in age change?
+* 1) Insert a breakpoint on the lines indicated in the code. Done
+* 2) Run to Breakpoint 1. Done
+* 3) When prompted, enter your age. Done
+* 4) When the execution stops, add a watch on age and verify that Done
+* the value in age is what you typed in. Yes. It is correct.
+* 5) Step over the if statement. Done
+* 6) Why did the value in age change? No. It should not change.
+*
* 7) Fix the problem and repeat Steps 2 � 5 to verify the
-* problem was corrected.
-* 8) Stop debugging.
+* problem was corrected. Problem solved and commented at the spot
+* 8) Stop debugging. Done
*
* Debugging Exercise 2
*
-* 1) Run to Breakpoint 1.
-* 2) When prompted, enter the value 25 for your age.
+* 1) Run to Breakpoint 1. Done
+* 2) When prompted, enter the value 25 for your age. Done
* 3) Step over the if statement. Execution of the program should
-* continue on the else if statement.
-* 4) Verify that 25 is still stored in age.
-* 5) Step over the else if.
-* 6) Why is the program going to print "Teenager" for an age of 25?
-* 7) Fix the problem and repeat Steps 1 � 5 to verify the
+* continue on the else if statement. Yes. It does.
+* 4) Verify that 25 is still stored in age. Yes. It is stored
+* 5) Step over the else if. Done
+* 6) Why is the program going to print "Teenager" for an age of 25? Because it used OR instead of AND.
+* The both of conditions should be satisfied.
+* So, I changed || into &&.
+* 7) Fix the problem and repeat Steps 1 � 5 to verify the Done
* problem was corrected.
-* 8) Stop debugging.
-* 9) Remove Breakpoint1.
+* 8) Stop debugging. Done
+* 9) Remove Breakpoint1. Done
*
* Debugging Exercise 3
*
-* 1) Run the program without debugging.
-* 2) When prompted, enter the value of 10 for your age.
-* 3) Why does the program print both "Child" and "Adult"?
-* 4) Re-run the program this time with debugging and run to
-* Breakpoint 2.
-* 5) Why is the action with the else executing?
-* 6) Fix the problem and re-run to verify the problem was corrected.
-********************************************************************/
+* 1) Run the program without debugging. Yes, I did
+* 2) When prompted, enter the value of 10 for your age. Yes, I did
+* 3) Why does the program print both "Child" and "Adult"? Because of ; after else
+* 4) Re-run the program this time with debugging and run to
+* Breakpoint 2. Done
+* 5) Why is the action with the else executing? ; means the end of the line and it stops right there.
+*
+* 6) Fix the problem and re-run to verify the problem was corrected. Done
+*/
#include <iostream>
+
using std::cout;
using std::endl;
using std::cin;
-int main()
-{
- int age = 0;
+int main() {
+
+ int age = 0;
- cout << "Enter your age: ";
- cin >> age;
+ cout << "Enter your age: " <<endl;
+ cin >> age;
- // Breakpoint 1
- // Put a breakpoint on the following line
- if (age = 1)
- cout << "First Birthday" << endl;
- else if (age >= 12 || age <= 19)
+ // Breakpoint 1
+ // Put a breakpoint on the following line
+ if (age == 1) // In C++, == means equal, so I corrected it.
+ cout << "First Birthday" << endl;
+ else if (age >= 12 && age <= 19) // && should be used here not ||
cout << "Teenager" << endl;
- else if (age < 12)
- cout << "Child" << endl;
- else if (age > 62)
- cout << "Senior" << endl;
- // Breakpoint 2
- // Put a breakpoint on the following line
- else;
- cout << "Adult" << endl;
+ else if (age < 12 && age > 1)
+ cout << "Child" << endl;
+ else if (age >= 62 )
+ cout << "Senior" << endl;
+ // Breakpoint 2
+ // Put a breakpoint on the following line
+ else
+ cout << "Adult" << endl;
- return 0;
-} \ No newline at end of file
+ return 0;
+ }
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.command.1.tlog b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.command.1.tlog
new file mode 100644
index 0000000..f105298
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.command.1.tlog
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.read.1.tlog b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.read.1.tlog
new file mode 100644
index 0000000..f9ae1a6
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.read.1.tlog
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.write.1.tlog b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.write.1.tlog
new file mode 100644
index 0000000..501d51c
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CL.write.1.tlog
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CST116-Ch7-Debugging.lastbuildstate b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CST116-Ch7-Debugging.lastbuildstate
new file mode 100644
index 0000000..ffca743
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/CST116-Ch7-Debugging.lastbuildstate
@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
+Debug|Win32|C:\Users\batbo\Source\Repos\CST116\cst116-ch7-debugging-Batbold74\CST116-Ch7-Debugging\|
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.command.1.tlog b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.command.1.tlog
new file mode 100644
index 0000000..09249c2
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.command.1.tlog
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.read.1.tlog b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.read.1.tlog
new file mode 100644
index 0000000..36236e9
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.read.1.tlog
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.write.1.tlog b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.write.1.tlog
new file mode 100644
index 0000000..ccf2e79
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-C.b0d44148.tlog/link.write.1.tlog
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe
new file mode 100644
index 0000000..8819c18
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe.recipe b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe.recipe
new file mode 100644
index 0000000..1d45732
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.exe.recipe
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+ <ProjectOutputs>
+ <ProjectOutput>
+ <FullPath>C:\Users\batbo\Source\Repos\CST116\cst116-ch7-debugging-Batbold74\CST116-Ch7-Debugging\Debug\CST116-Ch7-Debugging.exe</FullPath>
+ </ProjectOutput>
+ </ProjectOutputs>
+ <ContentFiles />
+ <SatelliteDlls />
+ <NonRecipeFileRefs />
+</Project> \ No newline at end of file
diff --git a/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.ilk b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.ilk
new file mode 100644
index 0000000..aed61e7
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.ilk
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.obj b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.obj
new file mode 100644
index 0000000..df5555f
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.obj
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.pdb b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.pdb
new file mode 100644
index 0000000..86c1992
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.pdb
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.vcxproj.FileListAbsolute.txt b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.vcxproj.FileListAbsolute.txt
new file mode 100644
index 0000000..5f71896
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/CST116-Ch7-Debugging.vcxproj.FileListAbsolute.txt
@@ -0,0 +1 @@
+C:\Users\batbo\Source\Repos\CST116\cst116-ch7-debugging-Batbold74\CST116-Ch7-Debugging\Debug\CST116-Ch7-Debugging.exe
diff --git a/CST116-Ch7-Debugging/Debug/cst116-ch7-debugging.obj.enc b/CST116-Ch7-Debugging/Debug/cst116-ch7-debugging.obj.enc
new file mode 100644
index 0000000..bc7306e
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/cst116-ch7-debugging.obj.enc
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/vc143.idb b/CST116-Ch7-Debugging/Debug/vc143.idb
new file mode 100644
index 0000000..1cddd08
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/vc143.idb
Binary files differ
diff --git a/CST116-Ch7-Debugging/Debug/vc143.pdb b/CST116-Ch7-Debugging/Debug/vc143.pdb
new file mode 100644
index 0000000..d482ede
--- /dev/null
+++ b/CST116-Ch7-Debugging/Debug/vc143.pdb
Binary files differ