aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah Wu <[email protected]>2022-10-11 23:09:36 -0700
committerHannah Wu <[email protected]>2022-10-11 23:09:36 -0700
commitec7f765cc512d0b66533ed476ce2da202d16bdc2 (patch)
tree1422e4155b822f58b670ba4d1a3c4d360024613d
parentFixed main errors. Added pseudocode file. Added output text file. (diff)
downloadcst116-ch7-debugging-wu-main.tar.xz
cst116-ch7-debugging-wu-main.zip
UpdatesHEADmain
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp10
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.txt20
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-DebuggingPseudocode.txt11
3 files changed, 36 insertions, 5 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index f64adfe..75cfd49 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -56,17 +56,17 @@ 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)
+ else if (age <= 12 && age >= 1)
cout << "Child" << endl;
- else if (age > 62)
+ else if (age >= 62)
cout << "Senior" << endl;
// Breakpoint 2
// Put a breakpoint on the following line
- else;
+ else if (age >=18 && age <= 62)
cout << "Adult" << endl;
return 0;
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.txt b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.txt
new file mode 100644
index 0000000..1d3aec8
--- /dev/null
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.txt
@@ -0,0 +1,20 @@
+Debugging Exercise 1:
+Enter your age: 27
+Adult
+
+C:\Users\hanna\Source\Repos\cst116-ch7-debugging-Wu\CST116-Ch7-Debugging\Debug\CST116-Ch7-Debugging.exe (process 15652) exited with code 0.
+Press any key to close this window . . .
+
+Debugging exercise 2:
+Enter your age: 25
+Adult
+
+C:\Users\hanna\Source\Repos\cst116-ch7-debugging-Wu\CST116-Ch7-Debugging\Debug\CST116-Ch7-Debugging.exe (process 33856) exited with code 0.
+Press any key to close this window . . .
+
+Debugging exercise 3:
+Enter your age: 10
+Child
+
+C:\Users\hanna\Source\Repos\cst116-ch7-debugging-Wu\CST116-Ch7-Debugging\Debug\CST116-Ch7-Debugging.exe (process 33072) exited with code 0.
+Press any key to close this window . . . \ No newline at end of file
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-DebuggingPseudocode.txt b/CST116-Ch7-Debugging/CST116-Ch7-DebuggingPseudocode.txt
new file mode 100644
index 0000000..47c71cf
--- /dev/null
+++ b/CST116-Ch7-Debugging/CST116-Ch7-DebuggingPseudocode.txt
@@ -0,0 +1,11 @@
+IF input=!0 THEN SET input=AGE
+IF AGE = 1
+ PRINT "First Birthday"
+ELSE IF AGE >= 12 AND <=19
+ PRINT "Teenager"
+ELSE IF AGE <=12 AND >=1
+ PRINT "Child"
+ELSE IF AGE >= 62
+ PRINT "Senior"
+ELSE IF AGE >= 18 AND AGE <= 62
+ PRINT "Adult" \ No newline at end of file