From 1a08cd5f8ffeb3e03c9a0bd0a2b8d543885796fd Mon Sep 17 00:00:00 2001 From: JonCr Date: Wed, 5 Oct 2022 17:54:53 -0700 Subject: Finished --- CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp | 4 +++- CST116-ch5-Crombie-psuedo-code.txt | 13 +++++++++++++ CST116-ch5-Crombie.txt | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 CST116-ch5-Crombie-psuedo-code.txt create mode 100644 CST116-ch5-Crombie.txt diff --git a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp index 4d09c03..932437e 100644 --- a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp +++ b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp @@ -40,7 +40,9 @@ * 5) Notice that the current line of execution is now at the * calculation. * 6) Look at your watch. What is the value of money? +* A) It is $125.449997 * 7) Hover your mouse pointer over raise. What is its value? +* A) It is 0.100000001 * 8) Step over the calculation. Notice the watch on money is now * red. This designates that the variable just changed its value. * 9) What happened to our money? I thought a raise was supposed @@ -78,7 +80,7 @@ int main() cout << "Enter percent raise: "; cin >> raise; - money = money * raise; + money = money * (1 + raise); cout << "After your raise you have $"; cout << money << endl; diff --git a/CST116-ch5-Crombie-psuedo-code.txt b/CST116-ch5-Crombie-psuedo-code.txt new file mode 100644 index 0000000..7523432 --- /dev/null +++ b/CST116-ch5-Crombie-psuedo-code.txt @@ -0,0 +1,13 @@ +Set money = 123.45 +Create "raise" variable + +Display current amount of money + "You have $[money]" + +Prompt user to enter raise amount + "Enter percent raise: " + +Add raise to current amount of money + +Display new amount of money + "After your raise you have $[money with raise]" \ No newline at end of file diff --git a/CST116-ch5-Crombie.txt b/CST116-ch5-Crombie.txt new file mode 100644 index 0000000..5969cfb --- /dev/null +++ b/CST116-ch5-Crombie.txt @@ -0,0 +1,6 @@ +You have $123.45 +Enter percent raise: 0.1 +After your raise you have $135.795 + +C:\Users\JonCr\source\repos\cst116-ch5-debugging-CognitiveShadow\CST116-Ch5-Debugging\x64\Debug\CST116-Ch5-Debugging.exe (process 2716) exited with code 0. +Press any key to close this window . . . -- cgit v1.2.3