Exemplo n.º 1
0
int main(void)
{
	char reply;
	struct date birthday;
	long no_of_days;

	do
	{

		printf("Please enter the date of your ");
		printf("birth, in the form: dd mm yy\n");

		birthday = read_date();
		no_of_days = get_day_number(birthday);
		printf("Number of days = %ld\n", no_of_days);
		printf("You were born on a ");
		write_day(no_of_days % 7);
		printf("Do you want to do that again? ");
		reply = getchar();
	} while (reply == 'y' || reply == 'Y');

	return 0;
}
Exemplo n.º 2
0
int DateTime::get_difference_in_days(const DateTime &other) const
{
	int day1 = get_day_number();
	int day2 = other.get_day_number();
	return day2 - day1;
}