From 4a21b2a833d07c47b477b78a27fd5390e4779b19 Mon Sep 17 00:00:00 2001 From: alexandra-apetroaei Date: Wed, 19 Oct 2022 13:34:58 -0800 Subject: This one is the finished product with the finished pusedo code! --- CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp') 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" ; } -- cgit v1.2.3