aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp')
-rw-r--r--CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp17
1 files changed, 8 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;
}