aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch7-Debugging
diff options
context:
space:
mode:
authorHunter <[email protected]>2022-10-13 17:19:41 -0700
committerHunter <[email protected]>2022-10-13 17:19:41 -0700
commitf7491bee62cb38d6fa93eb8e6b9c1060aa998597 (patch)
treeba0ba709ed04bbfa419015c53260bc7421e636ea /CST116-Ch7-Debugging
parentSetting up GitHub Classroom Feedback (diff)
downloadcst116-ch7-debugging-huntbyrne-f7491bee62cb38d6fa93eb8e6b9c1060aa998597.tar.xz
cst116-ch7-debugging-huntbyrne-f7491bee62cb38d6fa93eb8e6b9c1060aa998597.zip
Simple changes
Diffstat (limited to 'CST116-Ch7-Debugging')
-rw-r--r--CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
index f64adfe..51ec3ee 100644
--- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
+++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp
@@ -10,9 +10,9 @@
* 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.
+* the value in age is what you typed in.
* 5) Step over the if statement.
-* 6) Why did the value in age change?
+* 6) Why did the value in age change? // Because the line stating that age = 1 was executed by stepping over it.
* 7) Fix the problem and repeat Steps 2 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -47,27 +47,28 @@ using std::cout;
using std::endl;
using std::cin;
-int main()
-{
+int main(){
int age = 0;
-
- cout << "Enter your age: ";
+ cout << "Enter your age: " << endl;
cin >> age;
// 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) {
cout << "Child" << endl;
- else if (age > 62)
+ } else if (age > 62) {
cout << "Senior" << endl;
+ }
// Breakpoint 2
// Put a breakpoint on the following line
- else;
- cout << "Adult" << endl;
+ else {
+ cout << "Adult" << endl;
+ }
return 0;
-} \ No newline at end of file
+}
+