A temperature sensor outputs a raw reading in 0.1°C units. Create two overloaded functions named readTemp:
float readTemp(int raw)
float readTemp(int raw, char unit)
unit == 'C',
If unit == 'F', Convert Celsius to Fahrenheit using:
unit == 'F',
F = C * 1.8 + 32
In main():
main()
'D', 'C', 'F'
unit == 'D', call readTemp(raw)
readTemp(raw, unit)
float
Example 1
Input:
250 D
Output:
25
Example 2
250 F
77
Constraints: Use function overloading, not condition checks inside a single function.
Test Cases
Test Results
Input
Expected Output