#include<iostream>
using namespace std;
class Time
{
int hour,minute,second;
public:
Time()
{
hour=0;
minute=0;
second=0;
}
Time(int a,int b,int c)
{
hour=a;
minute=b;
second=c;
}
void add(Time c1, Time c2)
{
second=c1.second+c2.second;
minute=c1.minute+c2.minute+second/60;
second%=60;
hour=c1.hour+c2.hour+minute/60;
minute%=60;
}
void display()
{
cout<<hour<<" hour "<<minute<<" minute "<<second<<" second";
}
};
int main()
{
int h,m,s;
cout<<"\nEnter the 1st hour , min and sec : ";
cin>>h>>m>>s;
Time c1(h,m,s);
cout<<"\nEnter the 2nd hour , min , sec : ";
cin>>h>>m>>s;
Time c2(h,m,s);
Time c3;
c3.add(c1,c2);
cout<<"\nThe time is : ";
c3.display();
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBUaW1lCnsKICAgIGludCBob3VyLG1pbnV0ZSxzZWNvbmQ7CiAgICBwdWJsaWM6CiAgICBUaW1lKCkKICAgIHsKICAgICAgICBob3VyPTA7CiAgICAgICAgbWludXRlPTA7CiAgICAgICAgc2Vjb25kPTA7CiAgICB9CiAgICBUaW1lKGludCBhLGludCBiLGludCBjKQogICAgewogICAgICAgIGhvdXI9YTsKICAgICAgICBtaW51dGU9YjsKICAgICAgICBzZWNvbmQ9YzsKICAgIH0KICAgIHZvaWQgYWRkKFRpbWUgYzEsIFRpbWUgYzIpCiAgICB7CiAgICAgICAgc2Vjb25kPWMxLnNlY29uZCtjMi5zZWNvbmQ7CiAgICAgICAgbWludXRlPWMxLm1pbnV0ZStjMi5taW51dGUrc2Vjb25kLzYwOwogICAgICAgIHNlY29uZCU9NjA7CiAgICAgICAgaG91cj1jMS5ob3VyK2MyLmhvdXIrbWludXRlLzYwOwogICAgICAgIG1pbnV0ZSU9NjA7CiAgICB9CiAgICB2b2lkIGRpc3BsYXkoKQogICAgewogICAgICAgIGNvdXQ8PGhvdXI8PCIgaG91ciAiPDxtaW51dGU8PCIgb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