write a program which displays a menu for temperature conversion; user will choose an option from the menu and program converts temperature for selected option. (use temperature conversion formula C/5=F-32/9=R/4)
SAMPLE OUTPUT:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Celsius to Reaumur
4. Reaumur to Celsius
1
Expert's answer
2012-10-18T11:01:05-0400
#include "iostream" using namespace std;
char s1, s2; float t, T;
void main(){ cout<<"enter \"c\" for Celsius, \"f\" for Fahrenheit, \"r\" for Reaumur: "; cin>>s1; cout<<"enter the temparature value: "; cin>>t; cout<<"enter the system you want convert to (\"c\" for Celsius, \"f\" for Fahrenheit, \"r\" for Reaumur): "; cin>>s2; if (s1==s2) T=t; if ((s1=='c')&&(s2=='f')) T = 9*t/5+32; if ((s1=='c')&&(s2=='r')) T = 4*t/5; if ((s1=='f')&&(s2=='c')) T = 5*(t-32)/9; if ((s1=='f')&&(s2=='r')) T = 4*(t-32)/9; if ((s1=='r')&&(s2=='c')) T = 5*t/4; if ((s1=='r')&&(s2=='f')) T = 9*t/4+32; cout<<t<<s1<<" = "<<T<<s2<<"\n"; system("pause"); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment