#include<iostream>
using namespace std;
int main()
{
int choice;
float F,C,K;
cout<<"\nEnter 1 to enter temperature in Centigrade : ";
cout<<"\nEnter 2 to enter temperature in Fahrenheit : ";
cout<<"\nEnter 3 to enter temperature in Kelvin : ";
cout<<"\n\nEnter your choice : ";
cin>>choice;
switch(choice)
{
case 1:
{
cout<<"\nEnter temperature in Centigrade : ";
cin>>C;
// formula to convert centigrade to fahrenheit
F=(1.8*C)+32;
// formula to convert centigrade to kelvin
K=C+273.15;
cout<<"\nThe Centigrade temperature in Fahrenheit is = "<<F<<endl;
cout<<"The Centigrade temperature in Kelvin is = "<<K<<endl;
break;
}
case 2:
{
cout<<"\nEnter temperature in Fahrenheit : ";
cin>>F;
// formula to convert fahrenheit to centigrade
C=0.555*(F-32);
// formula to convert fahrenheit to kelvin
K=0.555*(F-32)+273.15;
cout<<"\nThe Fahrenheit temperature in Centigrade is = "<<C<<endl;
cout<<"The Fahrenheit temperature in Kelvin is = "<<K<<endl;
break;
}
case 3:
{
cout<<"\nEnter temperature in Kelvin : ";
cin>>K;
// formula to convert kelvin to centigrade
C=K-273.15;
// formula to convert kelvin to fahrenheit
F=(K-273.15)*1.8+32;
cout<<"\nThe Kelvin temperature in Centigrade is = "<<C<<endl;
cout<<"The Kelvin temperature in Fahrenheit is = "<<F<<endl;
break;
}
default:
{
cout<<"You Entered an incorrect choice "<<endl;
}
}
return 0;
}