Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int hms_v_sec (int h,int m,int s)
- {
- return h*3600+m*60+s;
- }
- int hms_v_sec1 (int h1, int m1,int s1)
- {
- return h1*3600+m1*60+s1;
- }
- void sec_v_hms (int time, int &h, int &m, int &s)
- {
- h=time/3600;
- time=time%3600;
- m=time/60;
- time=time%60;
- s=time;
- }
- int main()
- {
- int h1,m1,s1,h,m,s,time,hour,min,sec,skupno,h3,m3,s3;
- cout << "Pretvornik casa hms - s" << endl;
- cout<< "Vpisi prvi cas: (h/m/s):";
- cin>>h>>m>>s;
- cout<<"Vpisi drugi cas: (h/m/s)";
- cin>>h1>>m1>>s1;
- cout<<endl;
- cout<<"cas v sekundah= "<<hms_v_sec (h,m,s)<<endl;
- cout<<"cas v sekundah= "<<hms_v_sec1 (h1,m1,s1)<<endl;
- if (hms_v_sec > hms_v_sec1)
- {
- skupno=hms_v_sec(h,m,s) - hms_v_sec1(h1,m1,s1);
- cout<<"razlika casov je: "<<skupno<<endl;
- }
- else
- skupno=hms_v_sec1(h1,m1,s1) - hms_v_sec(h,m,s);
- cout<<"Razlika casov je: "<<skupno<<endl;
- sec_v_hms (skupno,h3,m3,s3);
- cout<<endl<<"ure: "<<h3<<", minute: "<<m3<<", sekunde: "<<s3<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement