C++ Fungsi Selisih Waktu

#include<iostream>
#include<conio>

int a,b,c,d,e,f,tot1,tot2,sel,jam,men,det;

void input(){
cout<<" waktu pertama \n";
cout<<" => jam : ";cin>>a;
cout<<" => menit : ";cin>>b;
cout<<" => detik : ";cin>>c;
cout<<endl;
cout<<" waktu kedua \n";
cout<<" => jam : ";cin>>d;
cout<<" => menit : ";cin>>e;
cout<<" => detik : ";cin>>f;
}
void hitung(){
tot1=(a*3600)+(b*60)+c;
tot2=(d*3600)+(e*60)+f;
sel=tot2-tot1;
jam=sel/3600;
men=(sel%3600)/60;
det=(sel%3600)%60;
}
void hasil(){
cout<<" Selisih \n";
cout<<" => jam : "<<jam<<endl;
cout<<" => menit : "<<men<<endl;
cout<<" => detik : "<<det<<endl;
}

main(){
input();
hitung();
hasil();
getch();
}

0 Response to "C++ Fungsi Selisih Waktu"

Posting Komentar