Hi there,
Thanks again for those that helped with my Easter Sunday program. I was able to complete it.
Currently I am working on a program where you enter in a date 14 03 2013 (Day, Month, Year) and you get the next day. I seem to be coming stuck with months with less than 31 days, and the whole leap year thing.
Here is my code so far.
Code:
#include <stdio.h>
int day, month, year, next_day, next_month, next_year, calculation;
int main() {
printf("Enter a date in the form day/month/year: ");
scanf("%d %d %d", &day, &month, &year);
calculation = month - 1;
if (month == 2) {
if (year % 100 == 0) {
if (year % 400 == 0) {
calculation = 29;
} else if (year % 4 == 0) {
calculation = 29;
}
next_day = next_day +1;
next_month = month;
next_year = year;
if (next_day > calculation) {
next_day = 1;
next_month++;
}
if (next_month > 12) {
next_month = 1;
next_year++;
}
printf("The date of the next day is: %d %d %d", next_day, next_month, next_year);
}
}
}
Is there anything you can suggest to help me get my program working?