About

Wednesday, 18 January 2012

Program Konversi Suhu

#include <iostream.h> 
#include <conio.h>

int main() 
float C,R,K,F; 
char pilih, ulang;

start: 
clrscr(); 
<<endl<<endl;

cout<<"Masukkan besar suhu (celcius) yang ingin di Konversi : "<<endl; 
cout<<"-->"; 
cin>>C;
cout<<"Anda ingin mengkonversi "<<C<<" Celcius ke dalam apa ?"<<endl; 
cout<<"1. Reamur "<<endl; 
cout<<"2. Fahrenheit "<<endl;
cout<<"3. KElvin "<<endl; 
cout<<"4. Reamur, Fahrenheit, dan Kelvin "<<endl; 
cout<<"-->";
cin>>pilih; 
if (pilih=='1'){ 
R=0.8*C;
cout<<"jadi "<<C<<" Celcius = "<<R<<" Reamur"<<endl; 
else if (pilih=='2'){
F=(C*(9/5))+32; 
cout<<"jadi "<<C<<" Celcius = "<<F<<" Fahrenheit"<<endl; 
}
else if (pilih=='3'){ 
K=C+273; 
cout<<"jadi "<<C<<" Celcius = "<<K<<" Kelvin"<<endl;
else if (pilih=='4'){
R=0.8*C; F=(C*(9/5))+32 ;K=C+273;
cout<<"jadi "<<C<<" Celcius = "<<R<<" Reamur, "<<F<<" Fahrenheit, "<<K<<" Kelvin"<<endl;
}
else {
cout<<"Pilihan hanya ada 4"<<endl;
}
ask:
cout<<"Ulang kembali ? (y/n)"<<endl;
cin>>ulang;
if(ulang=='y'||ulang=='Y')
goto start;
else if (ulang=='n'||ulang=='Y')
return 0;
else {
goto ask;
}

}

Baca Juga Artikel dibawah ini :

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons