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.cpp14
1 files changed, 6 insertions, 8 deletions
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" ;
}