Program C++ Konversi Suhu
#include <iostream>using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
float cel,rea,fah,kel;
int a;
cout<<"KONVERSI SUHU\n";
cout<<"2. Celcius ke Reamur\n";
cout<<"3. Celcius ke Kelvin\n";
cout<<"Pilih salah satu(1/2/3) :"; cin>>a;
switch (a){
case 1:
cout<<"Masukan suhu Celcius: "; cin>>cel;
fah=cel*1.8+32;
cout<<cel<<"*"<<"1.8"<<"+32= "<< fah <<" fahrenheit"<<endl;
break;
case 2:
cout<<"Masukan suhu Celcius: "; cin>>cel;
rea=cel*4/5;
cout<<cel<<"*"<<"4/5"<<"= "<<rea<<" reamur\n"<<endl;
break;
case 3:
cout<<"Masukan suhu Celcius: "; cin>>cel;
kel=cel+273,15;
cout<<cel<<"+"<<"273.15"<<"= "<<kel<<" kelvin"<<endl;
break;
default:
cout<<"Maap bro, pilihan mu salah";
break;
}
return 0;
}
EmoticonEmoticon