// program konveresi suhu
#include <iostream.h>
float celcius(float a);
float farenheit(float a);
float reamour(float a);
float celc(float a);
void main (){
float a;
int pil;
cout <<"nama : HERYANTO \n";
cout <<"nim : 41811110055\n";
cout <<"======================\n";
cout <<"\nselamat datang di program konversi suhu :\n"<<endl;
cout <<"Masukkan Suhu : "; cin >>a;
cout <<"Pilih Konversi Berikut\n";
cout << "\n1. Celcius ke Farenheit";
cout << "\n2. Farenheit ke Celcius";
cout << "\n3. Celcius ke Reamour";
cout << "\n4. Reamour ke Celcius\n";
cout <<"\nPilihan Anda ?"; cin >>pil;
switch (pil){
case 1 :
cout <<"Suhu Menjadi : " << farenheit(a);
break;
case 2 :
cout <<"Suhu Menjadi : " << celcius(a);
break;
case 3 :
cout <<"Suhu Menjadi : " << reamour(a);
break;
case 4 :
cout <<"Suhu Menjadi : " << celc(a);
break;
default :
cout<<"maaf";
}
}
float celcius(float a){
return (a*1.8+2);
}
float farenheit(float a) {
return ((a-32/1.8));
}
float reamour(float a){
return (a*0.8);
}
float celc(float a){
return (a/0.8);
}
Tidak ada komentar:
Posting Komentar