diff options
Diffstat (limited to 'CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp deleted file mode 100644 index 18d240c..0000000 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/********************************************************************
-* File: CST116-Ch7-Debugging.cpp
-*
-* Name: Taylor Rogers
-*
-* General Instructions: Complete each step before proceeding to the
-* next.
-*
-* 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?
-*
-* "if" statement is set up incorrectly, it changed value of "age" to 1 instead of comparing the input variable "age" to the number 1
-*
-* 7) Fix the problem and repeat Steps 2 � 5 to verify the
-* problem was corrected.
-* 8) Stop debugging.
-*
-* Debugging Exercise 2
-*
-* 1) Run to Breakpoint 1.
-* 2) When prompted, enter the value 25 for your age.
-* 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.
-*
-* Still there
-*
-*
-* 5) Step over the else if.
-* 6) Why is the program going to print "Teenager" for an age of 25?
-*
-* because the OR operator was used when it should be an AND
-*
-* 7) Fix the problem and repeat Steps 1 � 5 to verify the
-* problem was corrected.
-* 8) Stop debugging.
-* 9) Remove Breakpoint1.
-*
-* 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"?
-*
-* the semicolon after "else" is ending the statement, so the "cout" on the next line is not conditional and prints every time the program is run.
-*
-* 4) Re-run the program this time with debugging and run to
-* Breakpoint 2.
-* 5) Why is the action with the else executing?
-*
-* I think it is because nothing will happen if it executes, so its the same as not excuting at all. Not really sure on this one.
-*
-* 6) Fix the problem and re-run to verify the problem was corrected.
-********************************************************************/
-
-#include <iostream>
-using std::cout;
-using std::endl;
-using std::cin;
-
-int main()
-{
- int age = 0;
-
- cout << "Enter your age: ";
- cin >> age;
-
- // Breakpoint 1
- // Put a breakpoint on the following line
- if (age == 1)
- cout << "First Birthday" << endl;
- else if (age >= 12 && age <= 19)
- 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;
-
- return 0;
-}
\ No newline at end of file |