Source code:
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main()
{
string date_in,date_out;
int day_in,day_out,
total_day,biaya;
cout<<"Masukan tanggal masuk kendaraan (dd/mm/yyyy):"<<endl;
cin>>date_in;
cout<<"Masukan tanggal keluar kendaraan (dd/mm/yyyy):"<<endl;
cin>>date_out;
day_in=atoi(date_in.c_str());
day_out=atoi(date_out.c_str());
total_day=day_out-day_in;
cout<<"lama parkir per hari: "<<total_day;
if(total_day>1)
{
biaya=total_day*3500;
}
else
{
biaya=3500;
}
cout<<"\n\nBiaya parkir anda RP= ";cout<<biaya;
getch();
}
Output:
Tidak ada komentar:
Posting Komentar