diff options
| author | alexandra-apetroaei <andra@MSI> | 2022-10-18 17:47:19 -0800 |
|---|---|---|
| committer | alexandra-apetroaei <andra@MSI> | 2022-10-18 17:47:19 -0800 |
| commit | 3e3a075a90d4e2ed5e1a7f7881f23d4e708f5f08 (patch) | |
| tree | 9f4b72a4b0e79251cbba74246949eeb188250228 | |
| parent | change (diff) | |
| download | cst116-ch9-debugging-alexandra-apetroaei-3e3a075a90d4e2ed5e1a7f7881f23d4e708f5f08.tar.xz cst116-ch9-debugging-alexandra-apetroaei-3e3a075a90d4e2ed5e1a7f7881f23d4e708f5f08.zip | |
added psuedocode
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 17 | ||||
| -rw-r--r-- | CST116-Ch9-Debugging/psuedocode.txt | 7 |
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 |