diff options
| author | prestonderek <[email protected]> | 2022-10-18 10:25:07 -0700 |
|---|---|---|
| committer | prestonderek <[email protected]> | 2022-10-18 10:25:07 -0700 |
| commit | 5fbdaa1b63aae7f4d1c17b8ff69d0d9c194bc499 (patch) | |
| tree | 7398768fc1c9f557f04ff3634a45277e3364355c /CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | |
| parent | Finished exercise 2 (diff) | |
| download | cst116-ch9-debugging-prestonderek-5fbdaa1b63aae7f4d1c17b8ff69d0d9c194bc499.tar.xz cst116-ch9-debugging-prestonderek-5fbdaa1b63aae7f4d1c17b8ff69d0d9c194bc499.zip | |
Exercise 3 complete
Diffstat (limited to 'CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp')
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp index 3b560fb..831faf3 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -68,6 +68,10 @@ //in exercise 2, age is greyed out in the watch window because in the calcdays function it is considered a constant.
+//exercise 3: when entering into the print function, the variables are flipped.
+ //Variables have to be in the correct order so that they print in the correct order.
+ //It will assign the first value called to the first value in the function
+
#include <iostream>
using std::cout;
using std::cin;
@@ -112,7 +116,7 @@ int CalcDays(int years) return days;
}
-void PrintResults(int days, int age)
+void PrintResults(int age, int days)
{
cout << age << "! Boy are you old!\n";
cout << "Did you know that you are at least " << days << " days old?\n\n";
|