“Rumus C++ Konversi Suhu”

Lanjut ke rumus C++ untuk mengonversi suhu baik dari celcius, reamur, fahrenheit dan kelvin.

Berikut ini rumusnya :

——————————————————————————————————————————————————————

#include<iostream.h>;

void main(){
int angka;
char suhu1,suhu2;
cout<<“Suhu Pertama Yang Dipilih : “<<endl;
cout<<“==========================”<<endl;
cout<<“a. Celcius”<<endl;
cout<<“b. Reamur”<<endl;
cout<<“c. Fahrenheit”<<endl;
cout<<“d. Kelvin”<<endl;
cout<<“==========================”<<endl;
cout<<“Masukkan Pilihan Suhu Pertama Yang Diinginkan : “<<endl;
cout<<“==========================”<<endl;
cin>>suhu1;
cout<<“==========================”<<endl;
cout<<“Masukkan Nilai Suhu Pertama  : “<<endl;
cin>>angka;
cout<<“Konversi ke Suhu : “<<endl;
cout<<“==========================”<<endl;
cout<<“a. Celcius”<<endl;
cout<<“b. Reamur”<<endl;
cout<<“c. Fahrenheit”<<endl;
cout<<“d. Kelvin”<<endl;
cout<<“Masukkan Pilihan Suhu Kedua Yang Diinginkan : “<<endl;
cin>>suhu2;
if(suhu1==’a’ && suhu2==’b’) {
cout<<angka*5/4;
}
if(suhu1==’a’ && suhu2==’c’) {
cout<<(angka-32)*5/9;
}
if(suhu1==’a’  && suhu2==’d’) {
cout<<(angka-273);
}
if(suhu1==’a’  && suhu2==’a’) {
cout<<angka;
}
if(suhu1==’b’ && suhu2==’b’) {
cout<<angka;
}
if(suhu1==’b’ && suhu2==’c’) {
cout<<(angka-32)*4/9;
}
if(suhu1==’b’ && suhu2==’a’) {
cout<<angka*4/5;
}
if(suhu1==’b’ && suhu2==’d’) {
cout<<(angka-273)*4/5;
}
if(suhu1==’c’ && suhu2==’b’) {
cout<<(angka+32)*9/4;
}
if(suhu1==’c’ && suhu2==’c’) {
cout<<angka;
}
if(suhu1==’c’ && suhu2==’a’) {
cout<<(angka+32)*9/5;
}
if(suhu1==’c’ && suhu2==’d’) {
cout<<(angka-273)+32*4/5;
}
if(suhu1==’d’ && suhu2==’b’) {
cout<<(angka+273)*5/4;
}
if(suhu1==’d’ && suhu2==’c’) {
cout<<(angka-32)+273*5/9;
}
if(suhu1==’d’ && suhu2==’a’) {
cout<<angka+273;
}
if(suhu1==’d’ && suhu2==’d’) {
cout<<angka;
}
cout<<” << Adalah Hasil Konversinya “<<endl;
cout<<“==========================”<<endl;

}

 

————————————————————————————————————————————————————–

 

Ya ya ya, semoga bermanfaat yah ^^

Leave a comment

Filed under Pelajaran

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s