i would like to ask help from u guys.. i dun understand what the below c++ code means. so please help me to explain.
void main()
{
int hour1,minute1,hour2,minute2,zone[4]={0};
input_time(&hour1,&minute1,&hour2,&minute2);
duration(hour1,minute1,hour2,minute2,zone);
printf("\nDurations = (%3d,%3d,%3d,%3d) \n",zone[0],zone[1],zone[2],zone[3]);
printf("Total charge = $%.2f\n\n",charge(zone));
}
void input_time(int *h1, int *m1, int *h2, int *m2)
{
printf("\nEnter start time (in hr and min): ");
scanf("%d %d",h1,m1);
printf("Enter end time (in hr and min): ");
scanf("%d %d",h2,m2);
}
void duration(int h1, int m1, int h2, int m2, int z[])
{
const int limit[4]={6,14,20,24}
int i=0,temph,tempm;
temph=h1;
tempm=m1;
while (interval (temph,tempm,h2,m2)>0)
{
if (temph<limit[i])
{
if (h2>=limit[i])
z[i]=interval(temph,tempm,limit[i],0);
else
z[i]=interval(temph,tempm,h2,m2);
temph=limit[i];
tempm=0;
}
i++;
}
}
int interval(int h1,int m1,int h2,int m2)
{
return ((h2*60+m2)-(h1*60+m1));
}
float charge(int z[])
{
return (float) (z[0]*5+z[1]*10+z[2]*8+z[3]*5)/100;
}