I need help to promote user to enter y/n in switch statement to continue or not for an other conversion after showing results of each conversion.
[code]
#include <iostream>
using namespace std;
int main()
{
char a;
double n, r1, r2;
cout<<"Please Chose the Temperature Unit to Convert: "<<endl<<endl;
cout<<"F for Fahrenheit to Celsius & Kelvin. "<<endl;
cout<<"C for Celsius to Fahrenheit & Kelvin. "<<endl;
cout<<"K for Kelvin to Fahrenheit & Celsius. "<<endl;
cin>>a;
switch (a)
{ case 'f':
case 'F':
cout<<"Enter your Valu in Fahrenheit: "<<endl;
cin>>n;
r1=(n+459.67)*5/9;
cout<<"Kelvin = "<<r1<<endl;
r2=r1-273.15;
cout<<"Celsius = "<<r2<<endl;
break;
case 'c':
case 'C':
cout<<"Enter your Valu in Celsius: "<<endl;
cin>>n;
r1=n+273.15;
cout<<"Kelvin = "<<r1<<endl;
r2=n*9/5+32;
cout<<"Fahrenheit = "<<r2<<endl;
break;
case 'k':
case 'K':
cout<<"Enter your Valu in Kelvin: "<<endl;
cin>>n;
r1=n-273.15;
cout<<"Celsius = "<<r1<<endl;
r2=r1*9/5+32;
cout<<"Fahrenheit = "<<r2<<endl;
break;
}
system("pause");
}
[\code]
Bookmarks