/** * Gets elapsed number of days between two dates */ int elapsedDays(struct Date d1, struct Date d2) { int n1 = calculateN(d1); int n2 = calculateN(d2); return (n2 > n1) ? n2 - n1 : n1 - n2; }
int main(void) { int calculateN (struct date random); int N, i; struct date specific; printf("Enter date (mm dd yyyy): "); scanf("%i%i%i", &specific.month, &specific.day, &specific.year); N = calculateN(specific); i = (N - 621049) % 7; printf("%i\n", i); printf("%c%c%c\n", shorts[i-1].name[0], shorts[i-1].name[1], shorts[i-1].name[2]); return 0; }
int calculateDay(struct date inputDate){ int calculateN(struct date); int n = calculateN(inputDate); int day = ( n - 621049 ) % 7; }