#include <iostream>
int main()
{
//F temp = C temp *9.0/5.0 + 32
const unsigned short ADD_SUBTRACT = 32;
const double RATIO = 9.0 / 5.0;
double tempIn, tempOut;
char typeIn, typeOut;
std::cout << "please enter temp [xx.x C] or [xx.x F]: ";
std::cin >> tempIn >> typeIn;
std::cin.ignore(100, '\n');
std::cout << "\n";
switch (typeIn)
{
case'C':
case'c':
tempOut = tempIn * RATIO + ADD_SUBTRACT;
typeOut = 'F';
typeIn = 'C';
break;
case'F':
case'f':
tempOut = (tempIn - ADD_SUBTRACT) / RATIO;
typeOut = 'C';
typeIn = 'F';
break;
default:
typeOut = 'E';
break;
}
if (typeOut != 'E')
{
std::cout << tempIn << typeIn
<< " = " << tempOut << typeOut << "\n";
}
else
{
std::cout << "Input error!";
}
return 0;
}