From 4e249a7bc41ce2c596034e921c6660415c6d528a Mon Sep 17 00:00:00 2001 From: Lloyd Crawford Date: Wed, 5 Oct 2022 16:23:01 -0700 Subject: Here is my CH6 debug assignment! --- CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp') diff --git a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp index 497e2f8..f572c79 100644 --- a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp +++ b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp @@ -51,10 +51,15 @@ 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; return 0; } +// To convert from Farenheit to celsius is 5/9 * ( F - 32). Part one has you test the code and you will discover that +// it says farenheit of 212 = 0 celcius. doing some arithmatic you find out 212 F = 100 C. It is due to an integer error +// in the fomula celcius = 5/9 * (fahrenheit - 32). Fix this by adding .0 to each number. +//Part 2 Has you correct the code to celcius = 5.0 / 9.0 * (fahrenheit - 32). This gives you the proper answer of 100 degrees Celcius. +// Hope this helps. LLoyd C \ No newline at end of file -- cgit v1.2.3