diff options
| author | alexandra-apetroaei <andra@MSI> | 2022-10-07 11:56:21 -0800 |
|---|---|---|
| committer | alexandra-apetroaei <andra@MSI> | 2022-10-07 11:56:21 -0800 |
| commit | 40bebce8f69e3f9baf7efcde5c334db00b35c683 (patch) | |
| tree | f2952448a059bf84e36815cae9f134cd7faca504 /CST116-Ch7-Debugging | |
| parent | first change (diff) | |
| download | cst116-ch7-debugging-alexandra-apetroaei-40bebce8f69e3f9baf7efcde5c334db00b35c683.tar.xz cst116-ch7-debugging-alexandra-apetroaei-40bebce8f69e3f9baf7efcde5c334db00b35c683.zip | |
step one
Diffstat (limited to 'CST116-Ch7-Debugging')
| -rw-r--r-- | CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp index f64adfe..6f8e6be 100644 --- a/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp +++ b/CST116-Ch7-Debugging/CST116-Ch7-Debugging.cpp @@ -13,6 +13,7 @@ * the value in age is what you typed in.
* 5) Step over the if statement.
* 6) Why did the value in age change?
+* // it change to one
* 7) Fix the problem and repeat Steps 2 � 5 to verify the
* problem was corrected.
* 8) Stop debugging.
@@ -43,6 +44,8 @@ ********************************************************************/
#include <iostream>
+
+using namespace std;
using std::cout;
using std::endl;
using std::cin;
@@ -56,9 +59,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 +69,9 @@ int main() cout << "Senior" << endl;
// Breakpoint 2
// Put a breakpoint on the following line
- else;
- cout << "Adult" << endl;
+ else
+ if ( age >= 20)
+ cout << "Adult" << endl;
return 0;
}
\ No newline at end of file |