Hasil Running |
/*PROGRAM TARIF PARKIR*/
#pragma argused
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
int jam, men, ong, jam1, men1, jam2, men2;
cout<<"PROGRAM TARIF PARKIR"<<endl;
cout<<"--------------------"<<endl;
cout<<"Masukkan waktu MASUK (24 jam) :"<<endl;
cout<<"* Jam : "; cin>>jam1;
cout<<"* Menit : "; cin>>men1;
cout<<endl;
cout<<"Masukkan waktu KELUAR (24 Jam) :"<<endl;
cout<<"* Jam : "; cin>>jam2;
cout<<"* Menit : "; cin>>men2;
cout<<endl;
if (men2-men1 < 0)
{
jam = jam2-jam1-1;
men = men2+60-men1;
}
else
{
jam = jam2-jam1;
men = men2-men1;
}
if (jam > 3)
ong = 8000;
else if (jam < 2)
ong = 2000;
else
ong = jam * 2000;
cout<<"Waktu MASUK : Pukul "<<jam1<<" lebih "<<men1<<" Menit"<<endl;
cout<<"Waktu KELUAR : Pukul "<<jam2<<" lebih "<<men2<<" Menit"<<endl;
cout<<"Lama PARKIR : "<<jam<<" Jam, "<<men<<" Menit"<<endl;
cout<<endl;
cout<<"ONGKOS PARKIR : Rp. "<<ong;
getch();
}
0 komentar:
Posting Komentar