F = (9/5)C + 32
C = (5/9)(F-32)
# include<iostream>
using namespace std;
void main()
{
int choice;
float f, c;
cout<<"To convert your temperature from Celsius to Fahrenheit press 1:"<<endl;
cout<<"To convert your temperature from Fahrenheit to Celsius press 2:"<<endl;
cout<<"To quite from the program press 3:"<<endl;
cout<<"Now Enter Your Choice: ";
cin>>choice;
if(choice==1)
{
cout<<"enter your temperature in Celsius : ";
cin>>c;
f = (9.0/5.0)*c + 32;
cout<<"Your temperature in Fahrenheit is = "<<f<<"\n";
cout<<"THANKS \n";
}
else if(choice==2)
{
cout<<"Enter Your Temperature In Fahrenheit : ";
cin>>f;
c = (5.0/9.0)*(f-32.0);
cout<<"Your temperature in Celsius is = "<<c<<"\n";
cout<<"THANKS \n";
}
else if(choice==3)
cout<<"You did not want to start conversion\n THANKS\n BYE BYE"<<"\n";
}
system("pause");
}
No comments:
Post a Comment