Minggu, 29 Juni 2014

Source Code C++ " Konversi Suhu "

#include
#include
#include
using namespace std;

int main()

{
while(true)
{
int temp,cel2fah,cel2kel,fah2cel,fah2kel,kel2cel,kel2fah; // Mendeklarasikan Fungsi

   cout <<" %%% Konversi Suhu %%% "< cout <<"Masukkan besar suhu: ";
cin >> temp;
cout< cel2fah = temp * 9 / 5 + 32; // rumus fisikanya
cel2kel = temp + 273; // rumus fisikanya
fah2cel = (temp - 32) * 5 / 9; // rumus fisikanya
fah2kel = (temp - 32) * 5 / 9 + 273; // rumus fisikanya
kel2cel = temp - 273; // rumus fisikanya
kel2fah = (temp - 273) * 9 / 5 + 32; // rumus fisikanya
cout << temp << "  C = " << cel2fah << " F" << endl;
cout << temp << "  C = " << cel2kel << " K" << endl;
cout << temp << "  F = " << fah2cel << " C" << endl;
cout << temp << "  F = " << fah2kel << " K" << endl;
cout << temp << "  K = " << kel2cel << " C" << endl;
cout << temp << "  K = " << kel2fah << " F" << endl;
cout << "\n";
char Question;
cout << "ulangi? [Y/N]: ";
cin >> Question;
if (Question == 'Y')
{
continue;
}
else if (Question == 'N')
{
return 0;
}
else
{
return 0;
}
}
}


Tidak ada komentar:

Posting Komentar