diff options
| author | Taylor Rogers <[email protected]> | 2022-10-08 08:47:00 -0700 |
|---|---|---|
| committer | Taylor Rogers <[email protected]> | 2022-10-08 08:47:00 -0700 |
| commit | 0492d4c83ddaf77861b3f81da62872e467f1f5bf (patch) | |
| tree | 176a41cd897220c67592bc1775d00981c5ba003b | |
| parent | Answered question 6 (diff) | |
| download | cst116-ch6-debugging-taylorrog-0492d4c83ddaf77861b3f81da62872e467f1f5bf.tar.xz cst116-ch6-debugging-taylorrog-0492d4c83ddaf77861b3f81da62872e467f1f5bf.zip | |
Answered Q4 and added Q6 c option to celsius
| -rw-r--r-- | CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp | 8 |
1 files 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;
|