Include <iostream>
Using namespace std;
Int main() {
Char choice;
Double temperature, convertedTemperature;
// Display available conversion options
Cout << “Temperature Converter” << endl;
Cout << “Select conversion option:” << endl;
Cout << “1. Celsius to Fahrenheit” << endl;
Cout << “2. Fahrenheit to Celsius” << endl;
Cout << “3. Celsius to Kelvin” << endl;
Cout << “4. Kelvin to Celsius” << endl;
Cout << “5. Fahrenheit to Kelvin” << endl;
Cout << “6. Kelvin to Fahrenheit” << endl;
Cin >> choice;
// Input the temperature to convert
Cout << “Enter the temperature: “;
Cin >> temperature;
// Perform the chosen conversion
Switch(choice) {
Case ‘1’:
convertedTemperature = (temperature * 9/5) + 32;
cout << “Result: “ << temperature << “ Celsius = “ << convertedTemperature << “
Fahrenheit” << endl;
break;
case ‘2’:
convertedTemperature = (temperature – 32) * 5/9;
cout << “Result: “ << temperature << “ Fahrenheit = “ << convertedTemperature << “
Celsius” << endl;
break;
case ‘3’:
convertedTemperature = temperature + 273.15;
cout << “Result: “ << temperature << “ Celsius = “ << convertedTemperature << “
Kelvin” << endl;
break;
case ‘4’:
convertedTemperature = temperature – 273.15;
cout << “Result: “ << temperature << “ Kelvin = “ << convertedTemperature << “
Celsius” << endl;
break;
case ‘5’:
convertedTemperature = (temperature – 32) * 5/9 + 273.15;
cout << “Result: “ << temperature << “ Fahrenheit = “ << convertedTemperature << “
Kelvin” << endl;
break;
case ‘6’:
convertedTemperature = (temperature – 273.15) * 9/5 + 32;
cout << “Result: “ << temperature << “ Kelvin = “ << convertedTemperature << “
Fahrenheit” << endl;
break;
default:
cout << “Error: Invalid option!” << endl;
break;
}
Return 0;