aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CST116-Ch9-Debugging/CST116-Ch9-Debugging-Apetroaei.cpp16
-rw-r--r--CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp14
-rw-r--r--CST116-Ch9-Debugging/Ch9-psuedocode.txt5
3 files changed, 21 insertions, 14 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Apetroaei.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Apetroaei.cpp
index 7fce779..308eaf8 100644
--- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Apetroaei.cpp
+++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Apetroaei.cpp
@@ -80,7 +80,7 @@ int main()
// Breakpoint 1
// Put breakpoint on the following line
- age = GetAge( );
+ age = GetAge();
days = CalcDays( age);
// Breakpoint 2
@@ -89,6 +89,14 @@ int main()
return 0;
}
+
+int GetAge()
+int Calcdays(int years)
+void PrintResults(int age, int days)
+{
+ cout << age << " ! Boy are you old!" << endl;
+ cout << " Did you know that you are at least " << days << " days old?" << endl;
+}
int GetAge()
{
int age;
@@ -106,8 +114,4 @@ int CalcDays( int years)
return days;
}
-void PrintResults(int age, int days)
-{
- cout << age << " ! Boy are you old!\n";
- cout << " Did you know that you are at least " << days << " days old?\n\n";
-}
+
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
index 0cb38a8..75a69ee 100644
--- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
+++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
@@ -77,13 +77,11 @@ int main()
{
int age = 0;
int days = 0;
- int years = 0;
-
// Breakpoint 1
// Put breakpoint on the following line
- GetAge();
- int days = CalcDays( age);
+ age = GetAge();
+ days = CalcDays( age);
// Breakpoint 2
// Put breakpoint on the following line
@@ -95,7 +93,7 @@ int GetAge()
{
int age;
- cout << "Please enter your age: " << endl;
+ cout << "Please enter your age: ";
cin >> age;
return age;
@@ -104,12 +102,12 @@ int CalcDays( int years)
{
int days;
- days = int years * const int DAYS_PER_YEAR;
+ days = years * DAYS_PER_YEAR;
return days;
}
void PrintResults(int age, int days)
{
- cout << age << " ! Boy are you old!" << endl ;
- cout << " Did you know that you are at least " << days << " days old?" << endl;
+ cout << age << " ! Boy are you old!\n" ;
+ cout << " Did you know that you are at least " << days << " days old?\n\n" ;
}
diff --git a/CST116-Ch9-Debugging/Ch9-psuedocode.txt b/CST116-Ch9-Debugging/Ch9-psuedocode.txt
new file mode 100644
index 0000000..6f25821
--- /dev/null
+++ b/CST116-Ch9-Debugging/Ch9-psuedocode.txt
@@ -0,0 +1,5 @@
+Set variable age = 0
+Set variable days = 0
+
+Define variable years to user by (years * 365)
+Read output to user