/* temperature3.cpp converts temperatures from one scale to another scale.
 *
 * Input:  menu choices, temperatures
 * Output: menu, temperatures on other scale
 *************************************************************************/

#include <iostream.h>           // cin, cout, <<, >>
#include <string>               // string

#include "Heat.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;
}


