I'm completing an O'Reilly textbook on my own and I'm now at structures. One of the programming exercises is:
Design a structure to store time and date. Write a function to find the difference between two times in minutes.
I believe I have the structure part down, I'm confused about the difference function though. I'm being very lazy by not taking into consideration the amount of days apart, but the question asks for time apart so I'm going to pretend as if it's just a 24 hour day they are talking about. Can I call a structure in the parameters of a function? I certainly tried to. Any suggestions would help. Thanks
My code thus far(in no way completed):
#include <iostream>
int difference(struct date_time);
int main()
{
return 0;
}
struct date_time{
int day;
char month[20];
int year;
int second;
int minute;
int hour;
} super_date_time = {
29,
"may",
2013,
30,
30,
23
};
int difference(date_time)
{
int second1 = 45;
int minute1 = 50;
int hour1 = 24;
std::cout << "Time difference is " << hour1 - int hour
return 0;
}