#include using namespace std; float c_to_f(float temperature) { return (temperature * (9.0 / 5.0)) + 32.0; } float f_to_c(float temperature) { return (((temperature - 32.0) * 5.0) / 9.0); } int main(void) { float temperature; char unit; cout << "What is the input temperature? "; cin >> temperature; cout << "What are the units of the input temperature (C for Celcius or F for " "Fahrenheit)? "; cin >> unit; unit = toupper(unit); switch (unit) { case 'C': cout << "Your input temperature is " << temperature << unit; if (temperature < -273) { cout << " which is out of range (less than -273C)." << endl; return 1; } cout << " which is " << c_to_f(temperature) << "F" << "." << endl; break; case 'F': cout << "Your input temperature is " << temperature << unit; if (temperature < -416) { cout << " which is out of range (less than -416F)." << endl; return 2; } cout << " which is " << f_to_c(temperature) << "C" << "." << endl; break; default: cout << "The units you have specified are not one of C (Celcius) or F " "(Fahrenheit)" << endl; return 3; } return 0; }