October 2017
Beginner
318 pages
7h 26m
English
Once we're done with the Celsius conversion, we'll use another switch statement. This time, we'll use it on outputType, where the user has told us what temperature type they'd like to see the equivalent value of, or see the equivalent value in. Our cases are going to look very similar to the first half of our switch statement; however here instead of converting everything to Celsius, we're always going to be converting from Celsius. Once again, that means case C can simply break in any instances where we've converted to Celsius and then we no longer need to convert from Celsius:
// F to C: ((t-32.0f)*5.0f)/9.0f // C to K: t+273.15f // K to F: (((t-273.15f)*9.0f)/5.0f)+32.0f
Now, our explicit case ...
Read now
Unlock full access