Source Code C++:
#include<iostream.h>
#include<conio.h>
main()
{
int
j1=2,
m1=30,
d1=10,
j2=1,
m2=15,
d2=5,
d3,d5,w,x,y,z;
cout<<"Masukkan Waktu 1";
cout<<" = "<<j1;
cout<<" : "<<m1;
cout<<" : "<<d1;
cout<<" "<<endl; cout<<" "<<endl;
cout<<"Masukkan Waktu 2";
cout<<" = "<<j2;
cout<<" : "<<m2;
cout<<" : "<<d2;
cout<<" "<<endl; cout<<" "<<endl;
cout<<" "<<endl; cout<<" "<<endl;
d3=(j1*3600)+(m1*60)+d1;
cout<<"Konversi Waktu 1 ke Detik : "<<d3;
cout<<" "<<endl; cout<<" "<<endl;
d5=(j2*3600)+(m2*60)+d2;
cout<<"Konversi Waktu 2 ke Detik : "<<d5;
cout<<" "<<endl; cout<<" "<<endl;
cout<<" "<<endl; cout<<" "<<endl;
d5=d3-d5;
cout<<"Selisih Detik 1 dengan Detik 2 = "<<d5;
cout<<" "<<endl; cout<<" "<<endl;
cout<<" "<<endl; cout<<" "<<endl;
cout<<"Konversi Selisih ke Waktu ";
w=d5/3600;
x=d5%3600;
y=x/60;
z=x%60;
cout<<" = "<<w;
cout<<" : "<<y;
cout<<" : "<<z;
getch();
}
Hasilnya:
Senin, 20 Juni 2011
Langganan:
Posting Komentar (Atom)