#include <iostream.h>
int hour(int,int,int);
int minits(int,int,int);
int seconds(int,int,int);
int main()
{
int hours=0,hours1=0;
int mints=0,mints1=0;
int second=0,second1=0;
char chang=' ';
cout <<"Enter Hours Of The First Time : ";
cin >>hours;
cout <<"\n\nEnter minits of first time : ";
cin>>mints;
cout<<"\n\nEnter seconds of the first time : ";
cin>>second;
cout <<"Enter Hours Of The second Time : ";
cin >>hours1;
cout <<"\n\nEnter minits of second time : ";
cin>>mints1;
cout<<"\n\nEnter seconds of the second time : ";
cin>>second1;
hours=hours-hours1;
mints=mints-mints1;
second=second-second1;
cout <<"\n\nnow enter how you want the difference \n\th for difference in hours \n\tm for difference in minuts \n\ts for difference in seconds \n\t = ";
cin >>chang;
switch (chang)
{
case 'h':
cout <<hour(hours,mints,second);
break;
case 'm':
cout <<minits(hours,mints,second);
break;
case 's':
cout <<seconds(hours,mints,second);
break;
default :
cout <<"\n\n wrong entry ";
}
return 0;
}
int hour(int h,int m,int s)
{
m=m/60;
s=s/(60*60);
h=h+m+s;
return h;
}
int minits(int h,int m,int s)
{
h=h*60;
s=s/60;
m=m+h+s;
return m;
}
int seconds(int h,int m,int s)
{
h=h*60*60;
m=m*60;
s=s+h+m;
return s;
}
int hour(int,int,int);
int minits(int,int,int);
int seconds(int,int,int);
int main()
{
int hours=0,hours1=0;
int mints=0,mints1=0;
int second=0,second1=0;
char chang=' ';
cout <<"Enter Hours Of The First Time : ";
cin >>hours;
cout <<"\n\nEnter minits of first time : ";
cin>>mints;
cout<<"\n\nEnter seconds of the first time : ";
cin>>second;
cout <<"Enter Hours Of The second Time : ";
cin >>hours1;
cout <<"\n\nEnter minits of second time : ";
cin>>mints1;
cout<<"\n\nEnter seconds of the second time : ";
cin>>second1;
hours=hours-hours1;
mints=mints-mints1;
second=second-second1;
cout <<"\n\nnow enter how you want the difference \n\th for difference in hours \n\tm for difference in minuts \n\ts for difference in seconds \n\t = ";
cin >>chang;
switch (chang)
{
case 'h':
cout <<hour(hours,mints,second);
break;
case 'm':
cout <<minits(hours,mints,second);
break;
case 's':
cout <<seconds(hours,mints,second);
break;
default :
cout <<"\n\n wrong entry ";
}
return 0;
}
int hour(int h,int m,int s)
{
m=m/60;
s=s/(60*60);
h=h+m+s;
return h;
}
int minits(int h,int m,int s)
{
h=h*60;
s=s/60;
m=m+h+s;
return m;
}
int seconds(int h,int m,int s)
{
h=h*60*60;
m=m*60;
s=s+h+m;
return s;
}