0% found this document useful (0 votes)
19 views

Programming Assignment11

good

Uploaded by

Xahid Yousaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Programming Assignment11

good

Uploaded by

Xahid Yousaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream.

h>
main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;
cout << " *********** Temprature Conversion Calculator **************";
cout << "\n\n Please enter the temprature unit for which you want the
coverison ";
cout << "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout << "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout << "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:
cout << "\n\n Please enter you choice: ";
cin >> ch;
switch(ch)
{
case 'f':
case 'F':
cout << " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout << " Celcius =" << c_temp;
cout << "\n Kelvin =" << k_temp;
cout << "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'c':
case 'C':
cout << " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout << " Kelvin =" << k_temp;
cout << "\n Farhenheit =" << f_temp;
cout << "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'k':
case 'K':
cout << " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout << " Celcius =" << c_temp;
cout << "\n Farhenheit =" << f_temp;
cout << "\n Do you want to calcute another value (y/n): ";

cin >> quit;


if (quit == 'y' || quit == 'Y')
goto startagain;
break;
default:
cout << "\n Invalid Choice";
}
cout << endl<<endl;
system("pause");
}

You might also like