Pengkonversian

program c++

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

using namespace std;

void hariKeJam(int valueAwal){
cout << “=================================================” <<endl;
cout << valueAwal << ” hari = ” << valueAwal*24 << ” jam”;
}

void jamKeMenit(int valueAwal){
cout << “=================================================” <<endl;
cout << valueAwal << ” jam = ” << valueAwal*60 << ” menit”;
}

void menitKeDetik(int valueAwal){
cout << “=================================================” <<endl;
cout << valueAwal << ” menit = ” << valueAwal*60 << ” detik”;
}

int main(){
int value;
char pilih[4];
char ulang;
kembali :
cout << “Masukkan nilai yang ingin dikonversikan : “;
cin >> value;
cout << “=================================================” <<endl;
cout << “- Ketik jam untuk konversi hari ke jam” <<endl;
cout << “- Ketik mnt untuk konversi jam ke menit” <<endl;
cout << “- Ketik dtk untuk konversi menit ke detik” <<endl;
cout << “=================================================” <<endl;
cout << “Ketik pilihan : “;
cin >> pilih;
if(pilih==”jam”) hariKeJam(value);
else if(pilih==”mnt”) jamKeMenit(value);
else menitKeDetik(value);
cout << “\n=================================================” <<endl;
cout << “Apakah Anda ingi mengulang kembali (y/t) ? “;
cin >> ulang;
cout << “=================================================” <<endl;
if(ulang==’y’) goto kembali;
getch();
return EXIT_SUCCESS;
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s