// Converte le Tmperatutre da una scala all'altra #include using std::cout; using std::cin; using std::endl; using std::cerr; #include using std::string; #include "temperature.h" int main() { const string MENU = "To convert arbitrary temperatures, enter:\n" " A - to convert Fahrenheit to Celsius;\n" " B - to convert Celsius to Fahrenheit;\n" " C - to convert Celsius to Kelvin;\n" " D - to convert Kelvin to Celsius;\n" " E - to convert Fahrenheit to Kelvin; or\n" " F - to convert Kelvin to Fahrenheit.\n" "--> "; cout << MENU; char conversion; cin >> conversion; cout << "\nEnter the temperature to be converted: "; double temperature; cin >> temperature; double result; switch (conversion) { case 'A': case 'a': result = FahrToCelsius(temperature); break; case 'B': case 'b': result = CelsiusToFahr(temperature); break; case 'C': case 'c': result = CelsiusToKelvin(temperature); break; case 'D': case 'd': result = KelvinToCelsius(temperature); break; case 'E': case 'e': result = FahrToKelvin(temperature); break; case 'F': case 'f': result = KelvinToFahr(temperature); break; default: cerr << "\n*** Invalid conversion: " << conversion << endl; result = 0.0; } cout << "The converted temperature is " << result << endl; return 0; }