From ef0b78aecde1bfe18a69161c5179a8b556e8945d Mon Sep 17 00:00:00 2001 From: jacobdw22 Date: Fri, 30 Sep 2022 19:05:01 -0700 Subject: Final changes --- CST116-Ch6-Debugging/CST116-Ch6-Debugging-wilson.txt | 2 ++ CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp | 4 +++- CST116-Ch6-Debugging/CST116-Ch6-debugging-wilson-pseudo-code.txt | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 CST116-Ch6-Debugging/CST116-Ch6-Debugging-wilson.txt create mode 100644 CST116-Ch6-Debugging/CST116-Ch6-debugging-wilson-pseudo-code.txt (limited to 'CST116-Ch6-Debugging') diff --git a/CST116-Ch6-Debugging/CST116-Ch6-Debugging-wilson.txt b/CST116-Ch6-Debugging/CST116-Ch6-Debugging-wilson.txt new file mode 100644 index 0000000..0ac2182 --- /dev/null +++ b/CST116-Ch6-Debugging/CST116-Ch6-Debugging-wilson.txt @@ -0,0 +1,2 @@ +Enter temperature in Fahrenheit: 212 +212 degrees F = 100 degrees C \ No newline at end of file diff --git a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp index 497e2f8..0313bd4 100644 --- a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp +++ b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp @@ -13,6 +13,7 @@ * 5) Verify that the value you entered is stored correctly. * 6) Step over the conversion calculation. What is the value * in Celsius? Is that the correct value? No. +* -32.0000000 * 7) Remember your order of precedence. Put parentheses around * Fahrenheit - 32. This needs to be done before the multiplication. * 8) Stop debugging and recompile. @@ -24,6 +25,7 @@ * 3) Verify that the value you entered is stored correctly. * 4) Step over the conversion calculation. What is the value * in Celsius? Is that the correct value? No. +* 0.0000000 * 5) Look at the division. This is integer division. Therefore, * 5 / 9 = 0. This is not the result we are looking for. * 6) Modify the calculation so that it does floating point division. @@ -51,7 +53,7 @@ int main() // Breakpoint 1 // Put a breakpoint on the following line - celcius = 5 / 9 * fahrenheit - 32; + celcius = 5.0 / 9.0 * (fahrenheit - 32); cout << fahrenheit << " degrees F = " << celcius << " degrees C" << endl; diff --git a/CST116-Ch6-Debugging/CST116-Ch6-debugging-wilson-pseudo-code.txt b/CST116-Ch6-Debugging/CST116-Ch6-debugging-wilson-pseudo-code.txt new file mode 100644 index 0000000..9b8b805 --- /dev/null +++ b/CST116-Ch6-Debugging/CST116-Ch6-debugging-wilson-pseudo-code.txt @@ -0,0 +1,4 @@ +Display "Enter temperature in Fahrenheit:" +Read fahrenheit +celcius = 5.0 / 9.0 * (fahrenheit - 32) +Display fahrenheit "degrees F = " celsius "degrees C" \ No newline at end of file -- cgit v1.2.3