From 3e3a075a90d4e2ed5e1a7f7881f23d4e708f5f08 Mon Sep 17 00:00:00 2001 From: alexandra-apetroaei Date: Tue, 18 Oct 2022 17:47:19 -0800 Subject: added psuedocode --- CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 17 ++++++++--------- CST116-Ch9-Debugging/psuedocode.txt | 7 +++++++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 CST116-Ch9-Debugging/psuedocode.txt 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 -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 -- cgit v1.2.3