Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int x1,y1,x2,y2,sum,z,x,i,f;
- cin>>x1>>y1>>x2>>y2;
- if(x1>=0 && x1<24 && x2>=0 && x2<24 && y1>=0 && y1<60 && y2>=0 &&y1<60)
- {
- if(x1<x2 )
- {
- sum=(x2*60+y2)-(x1*60+y1);
- if(sum>60){
- z=sum/60;
- x=sum-(z*60);
- cout<<"O JOGO DUROU "<<z<<" HORA(S) E "<<x<<" MINUTO(S)"<<endl;
- }
- else{
- z=sum/60;
- x=sum;
- cout<<"O JOGO DUROU "<<z<<" HORA(S) E "<<x<<" MINUTO(S)"<<endl;
- }
- }
- else if(x1==x2 && y2>y1){
- sum=(x2*60+y2)-(x1*60+y1);
- z=sum/60;
- x=sum;
- cout<<"O JOGO DUROU "<<z<<" HORA(S) E "<<x<<" MINUTO(S)"<<endl;
- }
- else
- {
- i=(24*60)-(x1*60+y1);
- f=(x2*60+y2);
- sum=(i+f);
- if(sum>60){
- z=sum/60;
- x=sum-(z*60);
- cout<<"O JOGO DUROU "<<z<<" HORA(S) E "<<x<<" MINUTO(S)"<<endl;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement