Rabu, 14 November 2012

Program C++ ( Konversi suhu )

Disini ira mau nge-share program konversi suhu menggunakan bahasa C++ , semoga  membantu teman-teman ^^

Coding: 

#include <iostream>

using namespace std;

int main()
{
int cel, fah, rea;


cout << "=============================" << endl;
cout << "KONVERSI SUHU" << endl;
cout << "Celcius: Reamur: Fahrenheit" << endl;
cout << "=============================" << endl;
cout<< "Masukkan suhu dalam Celcius : ";
cin>>cel;
cout<< "Masukkan suhu dalam Reamur : ";
cin>>rea;
cout<< "Masukkan suhu dalam Fahrenheit : ";
cin>>fah;

cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU CELCIUS" << endl;
cout << "=============================" << endl;

cout << " fahrenheit : " << (((9.0/5.0)*cel) + 32)<<endl;
cout << " reamur     : " << ((4.0/5.0)*cel)<<endl;

cout << "==============================" << endl;
cout << "HASIL KONVERSI SUHU REAMUR" << endl;
cout << "==============================" << endl;

cout << " celcius   : " << ((5.0/4.0)*rea)<<endl;
cout << " fahrenheit: " << (((9.0/4.0)*rea) + 32)<<endl;

cout << "==============================" << endl;
cout << "HASIL KONVERSI SUHU FAHRENHEIT" << endl;
cout << "==============================" << endl;

cout << " celcius   : " << ((fah - 32)*(5.0/9.0))<<endl;
cout << " reamur    : " << ((fah - 32)*(4.0/9.0))<<endl;
}

Contoh di layar:



Tidak ada komentar:

Posting Komentar