Sabtu, 15 Maret 2014
Konversi Suhu
DALAN C++
int main(int argc, char *argv[])
{
float a;
float b;
float c;
float d;
int suhu;
cout<<"masukkan pilihan, 1.celcius,2.fahtenheit:"<<endl;
cin>>suhu;
switch (suhu)
{case 1:
cout<<"masukkan suhu celcius:";
cin>>a;
b=(4/5)*a;
cout<<"suhu dlm Reamur:"<<b<<endl;
c=((9/5)*a)+32;
cout<<"suhu dlm Fahrenheit:"<<c<<endl;
d=a+273;
cout<<"suhu dlm Kelvin:"<<d<<endl;
break;
case 2:
cout<<"masukkan Suhu Dlm Fahrenheit:";
cin>>c;
a=((5/9)*c)-32;
cout<<"suhu dlm Celsius:"<<a<<endl;
b=(((4/9)*c)-32);
cout<<"suhu dlm Reamur:"<<b<<endl;
d=(((5/9)*c)-32)+273;
cout<<"suhu dlm Kelvin:"<<d<<endl;
default:
cout<<"your coice is fales"<<endl;
}
system("PAUSE");
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar