From cf82bbd4f5cee0ad0dd71aca77d504296d65ea6b Mon Sep 17 00:00:00 2001 From: Tim Pearse Date: Wed, 12 Oct 2022 16:28:21 -0700 Subject: Change 1: The debugging, output, and pseudocode. --- CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 9 +++++---- cst116-Ch7-Pearse-Pseudocode.txt | 22 ++++++++++++++++++++++ cst116-Ch7-Pearse.txt | 23 +++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 cst116-Ch7-Pearse-Pseudocode.txt create mode 100644 cst116-Ch7-Pearse.txt diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index f64adfe..bc89e29 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -56,9 +56,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; @@ -66,8 +66,9 @@ int main() 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 diff --git a/cst116-Ch7-Pearse-Pseudocode.txt b/cst116-Ch7-Pearse-Pseudocode.txt new file mode 100644 index 0000000..c6d3b55 --- /dev/null +++ b/cst116-Ch7-Pearse-Pseudocode.txt @@ -0,0 +1,22 @@ +main(){ + int age + + print("Enter your age:") + input(age) + + if (age == 1){ + print("First Birthday") + } + elif (age >= 12 && age <= 19){ + print("Teenager") + } + elif (age < 12){ + print("Child") + } + elif (age > 62){ + print("Senior") + } + else{ + print("Adult") + } +} \ No newline at end of file diff --git a/cst116-Ch7-Pearse.txt b/cst116-Ch7-Pearse.txt new file mode 100644 index 0000000..fa00cbb --- /dev/null +++ b/cst116-Ch7-Pearse.txt @@ -0,0 +1,23 @@ +Enter your age: 1 +First Birthday + +C:\Users\legok\Source\Repos\cst116-ch7-debugging-legokid1503\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 18256) exited with code 0. +Press any key to close this window . . . + +Enter your age: 15 +Teenager + +C:\Users\legok\Source\Repos\cst116-ch7-debugging-legokid1503\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 12740) exited with code 0. +Press any key to close this window . . . + +Enter your age: 10 +Child + +C:\Users\legok\Source\Repos\cst116-ch7-debugging-legokid1503\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 11892) exited with code 0. +Press any key to close this window . . . + +Enter your age: 65 +Senior + +C:\Users\legok\Source\Repos\cst116-ch7-debugging-legokid1503\CST116-Ch7-Debugging\x64\Debug\CST116-Ch7-Debugging.exe (process 11648) exited with code 0. +Press any key to close this window . . . \ No newline at end of file -- cgit v1.2.3