From 0492d4c83ddaf77861b3f81da62872e467f1f5bf Mon Sep 17 00:00:00 2001 From: Taylor Rogers Date: Sat, 8 Oct 2022 08:47:00 -0700 Subject: Answered Q4 and added Q6 c option to celsius --- CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp index cfdbbd9..b0da9c0 100644 --- a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp +++ b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp @@ -27,7 +27,11 @@ * 2) When asked for a temperature, enter 212. * 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. +* in Celsius? Is that the correct value? +* +* No. +* +* * 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. @@ -55,7 +59,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; -- cgit v1.2.3