Friday, 20 November 2015

Konversi Suhu dengan C++ Lengkap

Assalamualaikum wr. wb

kali ini saya akan share source code c++ cara konversi suhu lengkap, kira-kira tampilannya seperti ini

source code nya:

/*Syaiful Romadhon
Sistem Informasi 2015
STT Terpadu Nurul Fikri*/


#include<iostream>
#include<cmath>
using namespace std;


int main()
{
int kode, kodeconv;
double nil;


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

cout << "       www.ssngeblog.blogspot.com   " << endl; 
cout << " celcius, Fahrenheit, Reamur, Kelvin" << endl;
cout << "====================================" << endl;
cout<<"Masukkan nilai awal = ";cin>>nil;
cout<< "Masukkan suhu dalam: "<<endl;
cout<<"1. Celcius"<<endl;
cout<<"2. Fahrenheit"<<endl;
cout<<"3. Reamur"<<endl;
cout<<"4. Kelvin"<<endl;
cout<<"kode = ";cin>>kode;
cout<< "Dikonversikan ke dalam: "<<endl;
cout<<"1. Celcius"<<endl;
cout<<"2. Fahrenheit"<<endl;
cout<<"3. Reamur"<<endl;
cout<<"4. Kelvin"<<endl;
cout<<"kode = ";cin>>kodeconv;

if (kode==1 and kodeconv ==1)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Celcius : " <<nil<<endl;
}
else if (kode == 1 and kodeconv == 2)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " fahrenheit : " <<(nil*1.8+32)<<endl;

}
else if (kode == 1 and kodeconv == 3)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Reamur  : " <<(nil*0.8)<<endl;

}
else if (kode == 1 and kodeconv == 4)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Kelvin : " <<(nil+ 273.15)<<endl;

}
else if (kode==2 and kodeconv ==1)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Celcius : " <<((nil+459.67)/1.8)<<endl;
}
else if (kode == 2 and kodeconv == 2)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " fahrenheit : " <<nil<<endl;

}
else if (kode == 2 and kodeconv == 3)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Reamur  : " <<((nil-32)/2.25)<<endl;

}
else if (kode == 2 and kodeconv == 4)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Kelvin : " <<((nil-32)/1.8)<<endl;

}
else if (kode == 3 and kodeconv ==1)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Celcius : " <<(nil/0.8)<<endl;
}
else if (kode == 3 and kodeconv == 2)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " fahrenheit : " <<(nil*2.25+32)<<endl;

}
else if (kode == 3 and kodeconv == 3)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Reamur  : " <<nil<<endl;

}
else if (kode == 3 and kodeconv == 4)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Kelvin : " <<(nil/0.8+273.15)<<endl;

}
else if (kode == 4 and kodeconv ==1)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Celcius : " <<(nil-273.15)<<endl;
}
else if (kode == 4 and kodeconv == 2)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " fahrenheit : " <<(nil*1.8-459.67)<<endl;

}
else if (kode == 4 and kodeconv == 3)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Reamur  : " <<((nil-273.15)*0.8)<<endl;

}
else if (kode == 4 and kodeconv == 4)
{
cout<<endl;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " Kelvin : " <<nil<<endl;

}
else
{
    cout<<"Kode yang Anda masukkan salah";
}

}

Jika butuh file mentahnya silahkan langsung download disini 
moga bermanfaat, jika ada yang mau ditanyakan silahkan corat-coret aja dibawah....

1 komentar:

  1. Perkenalkan, saya dari tim kumpulbagi. Saya ingin tau, apakah kiranya anda berencana untuk mengoleksi files menggunakan hosting yang baru?
    Jika ya, silahkan kunjungi website ini www.kbagi.com untuk info selengkapnya.

    Di sana anda bisa dengan bebas share dan mendowload foto-foto keluarga dan trip, music, video, filem dll dalam jumlah dan waktu yang tidak terbatas, setelah registrasi terlebih dahulu. Gratis :)

    ReplyDelete

Yang penting sopan, dan jangan nyampah, ditunggu kunjungan berikutnya yah :)