silahkan dilihat
disini saya memisahkan bagian proses dan bagian tampilan
----------------------source code-------------
#include
#include
float Kelvin(float a);
float Reamur(float a);
float Fahrenheit(float a);
void kelvin();
void reamur();
void fahrenheit();
float x,a;
main()
{
int nmr;
cout<<"---menu ubah suhu---\n";
cout<<"\n1. Celcius -> Kelvin" ;
cout<<"\n2. Celcius -> Reamur";
cout<<"\n3. Celcius -> Fahrenheit";
cout<<"\nPilih Nomor = ";
cin>>nmr;
cout<<"\nMasukkan nilai suhu (dalam derajat Celcius) = "<<"\n";
cin>>a;
switch (nmr) // memilih mana yang akan digunakan
{
case 1 : { kelvin();
break; }
case 2 : { reamur();
break; }
case 3 : { fahrenheit();
break; }
default : { return(0);}
}
}
//modul tampil ke layar
void kelvin ()
{
x=Kelvin(a);
cout<<"Suhu = "<
void reamur ()
{
x=Reamur(a);
cout<<"Suhu = "<
void fahrenheit ()
{
x=Fahrenheit(a);
cout<<"Suhu = "<
//---------------------------------------------------------------------------------------------
//proses
float Kelvin(float a)
{
float x;
x=a+273;
return x;
}
float Reamur(float a)
{
float x;
x=4/5*a;
return x;
}
float Fahrenheit(float a)
{
float x;
x=(9/5*a)+32;
return x;
}
//--------------------------------------------------------------------------------------------