aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp17
-rw-r--r--CST116-Ch9-Debugging/psuedocode.txt7
2 files changed, 15 insertions, 9 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
index 4234460..0cb38a8 100644
--- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
+++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
@@ -63,7 +63,6 @@
********************************************************************/
#include <iostream>
-using namespace std;
using std::cout;
using std::cin;
using std::endl;
@@ -71,7 +70,7 @@ using std::endl;
const int DAYS_PER_YEAR = 365;
int GetAge();
-void CalcDays(int age);
+int CalcDays(int age);
void PrintResults(int age, int days);
int main()
@@ -84,7 +83,7 @@ int main()
// Breakpoint 1
// Put breakpoint on the following line
GetAge();
- int days = CalcDays(age);
+ int days = CalcDays( age);
// Breakpoint 2
// Put breakpoint on the following line
@@ -96,21 +95,21 @@ int GetAge()
{
int age;
- cout << "Please enter your age: ";
+ cout << "Please enter your age: " << endl;
cin >> age;
return age;
}
-void CalcDays(years)
+int CalcDays( int years)
{
int days;
- days = years * DAYS_PER_YEAR;
+ days = int years * const int DAYS_PER_YEAR;
return days;
}
-void PrintResults(int days, int age)
+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!" << endl ;
+ cout << " Did you know that you are at least " << days << " days old?" << endl;
}
diff --git a/CST116-Ch9-Debugging/psuedocode.txt b/CST116-Ch9-Debugging/psuedocode.txt
new file mode 100644
index 0000000..e34e193
--- /dev/null
+++ b/CST116-Ch9-Debugging/psuedocode.txt
@@ -0,0 +1,7 @@
+Enter varialble age
+Enter variable days
+Set variable days in a year to 365
+
+Multiply variable years by variable days in a year
+
+Print results \ No newline at end of file