#include <iostream>

enum ConvertType
{
	Celsius = -1,
	Fahrenheit = -2
};

class Converter
{
protected:
	ConvertType _type;

public:
	Converter( ConvertType t ) : _type( t ) {}

	double Convert( double val )
	{
		if ( _type == Celsius ) // Convert to celsius
			return 1.8 * val + 32;;
		return ( val / 1.8 ) - 32;
	}
};

static Converter CreateConverter(ConvertType type)
{
	return Converter(type);
}

static void DoConvertion(short choice)
{
	using ct = ConvertType; // ct = ConvertType
	auto converter = CreateConverter( ( choice == 1 ? ct( -1 ) : ct( -2 ) ) ); // If choice == 1 convert to celcius, else convert to fahrenheit
	double temp = 0.0;
	std::cout << "Enter temperature: ";
	std::cin >> temp;
	std::cout << "Result: " << converter.Convert(temp) << std::endl;
}

int main()
{
	short choice = 1;
	std::cout << "Enter choice: ";
	std::cin >> choice;
	DoConvertion(choice);
}
