aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Bouchillon <[email protected]>2022-10-06 18:54:07 -0700
committerTrevor Bouchillon <[email protected]>2022-10-06 18:54:07 -0700
commit63c8702f524014bdc3deaa1c20bd38093f40f0c6 (patch)
tree34fff65ed9b29359e4517108b05d238f5e336ef4
parentDebug1 question answered. (diff)
downloadcst116-ch7-debugging-daboochillin-63c8702f524014bdc3deaa1c20bd38093f40f0c6.tar.xz
cst116-ch7-debugging-daboochillin-63c8702f524014bdc3deaa1c20bd38093f40f0c6.zip
Debug 1 complete
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp7
-rw-r--r--CST116-Ch7-Debugging/Output-Debug.txt14
2 files changed, 19 insertions, 2 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index 064a99e..6fb9e1c 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -34,6 +34,9 @@
* 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?
+* ************************************************************************************************************************
+* Because the compare operator is not correct. It needs to be && not ||.
+* ************************************************************************************************************************
* 7) Fix the problem and repeat Steps 1 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -64,9 +67,9 @@ int main()
// Breakpoint 1
// Put a breakpoint on the following line
- if (age = 1)
+ if (age == 1)
cout << "First Birthday" << endl;
- else if (age >= 12 || age <= 19)
+ else if (age >= 12 && age <= 19)
cout << "Teenager" << endl;
else if (age < 12)
cout << "Child" << endl;
diff --git a/CST116-Ch7-Debugging/Output-Debug.txt b/CST116-Ch7-Debugging/Output-Debug.txt
new file mode 100644
index 0000000..b64d225
--- /dev/null
+++ b/CST116-Ch7-Debugging/Output-Debug.txt
@@ -0,0 +1,14 @@
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Users\lacro\source\repos\cst116-ch7-debugging-DaBoochillin\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe'. Symbols loaded.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'.
+The thread 0x6a88 has exited with code 0 (0x0).
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'.
+'CST116-Ch7-Debugging.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'.
+The thread 0x187c has exited with code 0 (0x0).
+The thread 0x1318 has exited with code 0 (0x0).
+The program '[21260] CST116-Ch7-Debugging.exe' has exited with code 0 (0x0).