C++ Hitung Selisih Waktu

#include <iostream>
#include <conio.h>
#include <math.h>
int main(){
int a,b,c,d,e,f,tot1,tot2,sel,thas,sisa,bhas,shas;
cout<<"   ========================="<<endl;
cout<<"   ========>SELISIH<========"<<endl;
cout<<"   =========================\n\n"<<endl;
cout<<" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
cout<<" !! MASUKKAN TANGGAL AWAL :  !!\n";
cout<<" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n";
cout<<" => Tanggal : ";
cin>> a;
cout<<" => Bulan : ";
cin>> b;
cout<<" => Tahun : ";
cin>> c;
cout<<"\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
cout<<" !! MASUKKAN TANGGAL AKHIR : !!\n";
cout<<" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n";
cout<<" => Tanggal : ";
cin>> d;
cout<<" => Bulan : ";
cin>> e;
cout<<" => Tahun : ";
cin>> f;
tot1=(c*365)+(b*30)+a;
tot2=(f*365)+(e*30)+d;
sel=tot2-tot1;
thas=sel/365;
sisa=sel%365;
bhas=sisa/30;
shas=sisa%30;
cout<<endl;
cout<<"   ===============\n";
cout<<"   -----HASIL-----\n";
cout<<"   ===============\n";
cout<<"   "<<endl;
cout<<" TANGGAL AWAL : ";
cout<<" Tahun : Bulan : Hari"<<endl;
cout<<" "<<c<< "   :   " <<b<< "   :  " <<a<< endl;
cout<<"\n\n TANGGAL AKHIR : ";
cout<<" Tahun : Bulan : Hari"<<endl;
cout<<" "<<f<< "   :   " <<e<< "   :  " <<d<< endl;
cout<<"         =============\n";
cout<<"         -- SELISIH --\n";
cout<<"         =============\n\n";
cout<<" Tahun : Bulan : Hari"<<endl;
cout<<" "<<thas<<" : "<<bhas<<" : "<<shas<<endl;
getch();
}

0 Response to "C++ Hitung Selisih Waktu"

Posting Komentar