Question
Using the sample C++ program shown below, add statements starting line #14 to convert degrees in Fahrenheit to degrees in Celsius. Variable fahrenheit has a
Using the sample C++ program shown below, add statements starting line #14 to convert degrees in Fahrenheit to degrees in Celsius. Variable fahrenheit has a value of 212 (line #11) and it must be converted to some equivalent value in Celsius. Hence, it must be stored in the variable declared in line #12. Use the formula : celsius = (fahrenheit 32)* 5/9 for the conversion. Be careful and take note that in C++, 5/9 is evaluated to 0. To get the correct value, you have to write it as 5.0/9 or 5.0/9.0 or 5/9.0 Similarly, 9/5 is evaluated to 1. After the conversion, print both the values for fahrenheit and celsius.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started