所以用户输入年份+它告诉它是否是闰年..但现在我需要帮助让一周中的一天在闰年时弹出。
# include <math.h>
# include <stdio.h>
int main (void)
{
int yearEntered;
printf("Enter a year: ");
int read = scanf("%d", &yearEntered);
if (read == 0 )
{
printf("Bad input: requires an integer");
}
else if (yearEntered%4==0 && yearEntered%100!=0 || yearEntered%400==0)
{
printf("%04d is a leap year and February 29th is on a \n",yearEntered, dayString);
// Not so sure about this switch statement......
switch (DayOfWeek)
{
case 0:
{
dayString("Sunday");
break;
}
case 1:
{
dayString("Monday");
break;
}
case 2:
{
dayString("Tuesday");
break;
}
case 3:
{
dayString("Wednesday");
break;
}
case 4:
{
dayString("Thursday");
break;
}
case 5:
{
dayString("Friday");
break;
}
case 6:
{
dayString("Saturday");
break;
}
default:
{
dayString("");
}
}
else if (yearEntered < 1752)
{
printf("%04d is not a 4 digit year after 1752.",yearEntered);
}
else
{
printf("%d is not a leap year.\n",yearEntered);
}
return 0;
}