Kali ini saya akan memberikan tutorial konversi suhu dengan C++. Pada program ini user tinggal memasukkan suhu dalam celcius dan nantinya akan dikonversi ke dalam fahrenheit, reamur, dan kelvin.
Berikut tutoialnya ........
#include <conio.h>
#include <iostream.h>
main()
{
clrscr();
float suhu1, fahn, cel, ream, kel;
cout<<"==============================="<<endl;
cout<<" KONVERSI SUHU DARI CELCIUS KE"<<endl;
cout<<" Fahnrenheit : Reamur : Kelvin"<<endl;
cout<<"==============================="<<endl;
cout<<"Masukkan suhu dalam Celsius : "; cin>>suhu1;
cout<<"==============================="<<endl;
fahn = suhu1 * 9/5 + 32;
ream = suhu1 * 4/5;
kel = suhu1+273;
cout<<" HASIL KONVERSI "<<endl;
cout<<"==============================="<<endl;
cout<<"Fahnrenheit : "<<fahn<<" oC"<<endl;
cout<<"Reamur : "<<ream<<" oC"<<endl;
cout<<"Kelvin : "<<kel<<" oC"<<endl;
cout<<"==============================="<<endl;
getch();
}
0 komentar:
Posting Komentar