diff options
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";
|