Time Difference

Description:

Find the time difference of two time period (H:M:S)using function Test Case 1 Input (stdin) 11 8 55 8 4 22 Expected Output 11:8:55 - 8:4:22 = 3:4:33 Test Case 2 Input (stdin) 6 4 33 4 8 11 Expected Output 6:4:33 - 4:8:11 = 1:56:22

Program :

#include <iostream>
using namespace std;
int main()
{
  int a,b,c,d,e,f,g,h,i;
  cin>>a>>b>>c>>d>>e>>f;
 
  if( b>e){
  g=a-d;
    h=b-e;}
  else{
     g=(a-1)-d;
    h=(60+b)-e;}
  i=c-f;
  cout<<a<<":"<<b<<":"<<c<<" "<<"-"<<" "<<d<<":"<<e<<":"<<f<<" "<<"="<<" "<<g<<":"<<h<<":"<<i;
  
 return 0;
}