以下是引用C小易在2011-6-6 16:44:01的发言:
唉!都写得这么复杂!
# include "stdio.h"
int week(int y,int m,int d);
main()
{
int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int y,w,i,m=1,d=1;
printf("请输入一个年份yyyy:\n");
scanf("%d",&y);
if (y%4==0&&y%100!=0) monthday[1]=29;
for(m=1;m<=12;m++)
{
printf("\n %d年,%d月\n",y,m);
printf("S M T w T F S \n");
for (d=1;d<=monthday[m-1];d++)
{
w=week(y,m,d);
if(d==1)
{
for (i=0;i
他们写的已经不错了,你想要简单的啊,我给你一个20行左右的。唉!都写得这么复杂!
# include "stdio.h"
int week(int y,int m,int d);
main()
{
int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int y,w,i,m=1,d=1;
printf("请输入一个年份yyyy:\n");
scanf("%d",&y);
if (y%4==0&&y%100!=0) monthday[1]=29;
for(m=1;m<=12;m++)
{
printf("\n %d年,%d月\n",y,m);
printf("S M T w T F S \n");
for (d=1;d<=monthday[m-1];d++)
{
w=week(y,m,d);
if(d==1)
{
for (i=0;i