aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
diff options
context:
space:
mode:
authorprestonderek <[email protected]>2022-10-18 10:25:07 -0700
committerprestonderek <[email protected]>2022-10-18 10:25:07 -0700
commit5fbdaa1b63aae7f4d1c17b8ff69d0d9c194bc499 (patch)
tree7398768fc1c9f557f04ff3634a45277e3364355c /CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp
parentFinished exercise 2 (diff)
downloadcst116-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.cpp6
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";