Konversi Meter Menggunakan Dev C + +
WuanjrotBray,-
Konversi Meter sangat berguna dalam logika pengukuran, sehingga kita bisa terbiasa dengan perhitungan jarak.
#include<iostream>
using namespace std;
int main ()
{
float m;
float cm;
float dm;
float mm;
float menu;
cout <<" \n";
cout<<"-------------------------------------------------\n";
cout<<"-------------------------------------------------\n";
cout<<"| Program Konversi Meter |\n";
cout<<"-------------------------------------------------\n";
cout<<"-------------------------------------------------\n";
cout <<" 1. Meter ke Desimeter \n";
cout <<" 2. Meter ke Centimeter \n";
cout <<" 3. Meter ke Milimeter \n";
cout <<" 4. Desimeter ke Meter \n";
cout <<" 5. Desimeter ke Centimeter \n";
cout <<" 6. Desimeter ke Milimeter \n";
cout <<" 7. Centimeter ke Meter \n";
cout <<" 8. Centimeter ke Desimeter \n";
cout <<" 9. Centimeter ke Milimeter \n";
cout <<"10. Milimeter ke Meter \n";
cout <<"11. Milimeeter ke Desimeter \n";
cout <<"12. Milimeter ke Centimeter \n \n";
cout <<"Pilih Konversi : ";
Baca Juga : Sistem Oktal dan Heksa Desimal
cin >> menu;
if(menu==1){
cout <<"Masukkan Angka : ";
cin >> dm;
dm = dm*10;
cout <<"Hasilnya";
cout <<" ";
cout <<dm;
cout <<" ";
cout <<"Desimeter";
}
else if(menu==2){
cout <<"Masukkan Angka : ";
cin >> cm;
cm = cm*100;
cout <<"Hasilnya";
cout <<" ";
cout <<cm;
cout <<" ";
cout <<"Centimeter";
}
else if(menu==3){
cout <<"Masukkan Angka : ";
cin >> mm;
mm = mm*1000;
cout <<"Hasilnya";
cout <<" ";
cout <<mm;
cout <<" ";
cout <<"Milimeter";
}
else if(menu==4){
cout <<"Masukkan Angka : ";
cin >> m;
m = m/10;
cout <<"Hasilnya";
cout <<" ";
cout <<m;
cout <<" ";
cout <<"Meter";
}
else if(menu==5){
cout <<"Masukkan Angka : ";
cin >> cm;
cm = cm*10;
cout <<"Hasilnya";
cout <<" ";
cout <<cm;
cout <<" ";
cout <<"Centimeter";
}
else if(menu==6){
cout <<"Masukkan Angka : ";
cin >> mm;
mm = mm*100;
cout <<"Hasilnya";
cout <<" ";
cout <<mm;
cout <<" ";
cout <<"Milimeter";
}
else if(menu==7){
cout <<"Masukkan Angka : ";
cin >> m;
m = m/100;
cout <<"Hasilnya";
cout <<" ";
cout <<m;
cout <<" ";
cout <<"Meter";
}
else if(menu==8){
cout <<"Masukkan Angka : ";
cin >> dm;
dm = dm/10;
cout <<"Hasilnya";
cout <<" ";
cout <<dm;
cout <<" ";
cout <<"Desimeter";
}
else if(menu==9){
cout <<"Masukkan Angka : ";
cin >> mm;
mm = mm*10;
cout <<"Hasilnya";
cout <<" ";
cout <<mm;
cout <<" ";
cout <<"Milimeter";
}
else if(menu==10){
cout <<"Masukkan Angka : ";
cin >> m;
m = m/1000;
cout <<"Hasilnya";
cout <<" ";
cout <<m;
cout <<" ";
cout <<"Meter";
}
else if(menu==11){
cout <<"Masukkan Angka : ";
cin >> dm;
dm = dm/100;
cout <<"Hasilnya";
cout <<" ";
cout <<dm;
cout <<" ";
cout <<"Desimeter";
}
else if(menu==12){
cout <<"Masukkan Angka : ";
cin >> cm;
cm = cm/10;
cout <<"Hasilnya";
cout <<" ";
cout <<cm;
cout <<" ";
cout <<"Centimeter \n";
}
main();
return 0;
}
Post a Comment for "Konversi Meter Menggunakan Dev C + +"