#include <iostream>
#include <stdio.h>
using namespace std;
int CalculateTime(string timeBegin,sting timeEnd)
{
int hour1,minute1;
int hour2,minute2;
int hour,minute;
sscanf(timeBegin.c_str(),”%d:%d”,&hour1,&minute1);
sscanf(timeEnd.c_str(),”%d:%d”,&hour2,&minute2);
if(minute2 < minute1)
{
minute = minute2 + 60 – minute1;
hour2–;
} else
{
minute = minute2 – minute1;
}
if (hour2 < hour1)
{
hour = hour2 + 24 – hour1;
}else
{
hour = hour2 – hour1;
}
return hour
}
int main()
{
string time1 = “08:00”;
string time2 = “12:00”;
int hour = CalculateTime(time1,time2);
cout<<hour<<endl;
}