I'm really new to this, if fact just started 4 weeks ago. I'm trying to calculate the difference between to time.
I know where i'm going wrong just don't know how to rectify it.
Got time in and got time out, but time is in 60 minutes and not 100.
Please help.
int convert(char time[5])
{
int time_mins;
int int_time[4];
int_time[0]=time[0]-'0';
int_time[1]=time[1]-'0';
int_time[2]=time[2]-'0';
int_time[3]=time[3]-'0';
time_mins = int_time[0]* 1000 + int_time[1] * 100 + int_time[2] * 10 + int_time[3];
return time_mins;
}
void calctime ()
{
cout<<""<<endl;
cout<<" Please enter the start time of your call"<<endl;
cout<<""<<endl;
cin>> chstart;
cout<<""<<endl;
starttime = convert(chstart);
cout<<""<<endl;
cout<< starttime;
cout<<""<<endl;
cout<<""<<endl;
cout<<" Please enter the time your call ended"<<endl;
cout<<""<<endl;
cin>> chend;
cout<<""<<endl;
Endtime = convert(chend);
cout<<""<<endl;
cout<< Endtime;
totmins = (Endtime - starttime);
cout<<""<<endl;
cout<<" Your total minutes are: "; cout <<totmins;
cout<<""<<endl;
tothrs =(totmins / 60);
cout<<""<<endl;
cout<<" Your total hours are: "; cout <<tothrs;
cout<<""<<endl;
}