#include using namespace std; /* 1. F to C > What is the input temperature? 32 > What are the units of the input temperature (C for Celcius or F for Fahrenheit)? F > Your input temperature is 32F which is 0C. 2. C to F > What is the input temperature? 100 > What are the units of the input temperature (C for Celcius or F for Fahrenheit)? C > Your input temperature is 100C which is 212F. 3. Out of range C > What is the input temperature? -274 > What are the units of the input temperature (C for Celcius or F for Fahrenheit)? C > Your input temperature is -274C which is out of range (less than -273.15C or -416F) 4. Out of range F > What is the input temperature? -417 > What are the units of the input temperature (C for Celcius or F for Fahrenheit)? F > Your input temperature is -417 which is out of range (less than -273.15C or -416F) 5. Unknown unit > What is the input temperature? -40 > What are the units of the input temperature (C for Celcius or F for Fahrenheit)? Q > The units you have specified are not one of C (Celcius) or F (Fahrenheit). */ int main(void) { char input_units, output_units; float input_temp, output_temp; int error = 0; cout << "What is the input temperature? "; cin >> input_temp; cout << "What are the units of the input temperature (C for Celcius or F for " "Fahrenheit)? "; cin >> input_units; input_units = toupper(input_units); if (input_units == 'C') { cout << "Your input temperature is " << input_temp << input_units; if (input_temp < -273) { cout << " which is out of range (less than -273C or -416F)." << endl; } else { // output_units = 'F'; output_temp = (input_temp * (9.0 / 5.0)) + 32.0; cout << " which is " << output_temp << "F" << "." << endl; } } else if (input_units == 'F') { cout << "Your input temperature is " << input_temp << input_units; if (input_temp < -416) { cout << " which is out of range (less than -273C or -416F)." << endl; } else { // output_units = 'C'; output_temp = (((input_temp - 32.0) * 5.0) / 9.0); cout << " which is " << output_temp << "C" << "." << endl; } } else { cout << "The units you have specified are not one of C (Celcius) or F " "(Fahrenheit)" << endl; } return 0; }