diff options
| author | Lloyd Crawford <Lloyd Crawford@LAPTOP-7HJCDLE5> | 2022-10-05 16:23:01 -0700 |
|---|---|---|
| committer | Lloyd Crawford <Lloyd Crawford@LAPTOP-7HJCDLE5> | 2022-10-05 16:23:29 -0700 |
| commit | 4e249a7bc41ce2c596034e921c6660415c6d528a (patch) | |
| tree | ac2d754f6c34bede8794e93ad6dfb5f0360c1d4c /CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp | |
| parent | Setting up GitHub Classroom Feedback (diff) | |
| download | cst116-ch6-debugging-19-ruin-main.tar.xz cst116-ch6-debugging-19-ruin-main.zip | |
Diffstat (limited to 'CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp')
| -rw-r--r-- | CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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 |