首页 [训练]判断平年还是闰年是这一年第多少天

[训练]判断平年还是闰年是这一年第多少天

举报
开通vip

[训练]判断平年还是闰年是这一年第多少天[训练]判断平年还是闰年是这一年第多少天 #include void main() { int year,i,mouth,days,s=0; printf("本日历只适用于2012年,你也可以做修改。\n"); printf("Please you enter year:\n"); printf("Year="); scanf("%d",&year); if(year%400==0) { i=1; printf("This is a not leap year.\n"); if(i==1) ...

[训练]判断平年还是闰年是这一年第多少天
[训练]判断平年还是闰年是这一年第多少天 #include void main() { int year,i,mouth,days,s=0; printf("本日历只适用于2012年,你也可以做修改。\n"); printf("Please you enter year:\n"); printf("Year="); scanf("%d",&year); if(year%400==0) { i=1; printf("This is a not leap year.\n"); if(i==1) printf("please you enter mouth and days:\n"); printf("Mouth="); scanf("%d",&mouth); printf("Days="); scanf("%d",&days); switch(mouth) { case 1:s=0+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 2:s=31+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 3:s=60+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 4:s=91+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 5:s=121+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 6:s=152+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 7:s=182+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 8:s=213+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 9:s=244+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 10:s=274+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 11:s=305+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 12:s=335+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; default: printf("error\n"); } if(i==1) s=(s+7-1)%7; switch(s) { case 0:printf("This is Sunday.\n"); break; case 1:printf("This is Monday.\n"); break; case 2:printf("This is Tuesday.\n"); break; case 3:printf("This is Wednesday.\n"); break; case 4:printf("This is Thursday.\n"); break; case 5:printf("This is Friday.\n"); break; case 6:printf("This is Saturday.\n"); break; } } else i=0; if(i==0) { printf("This is a leap year.\n"); printf("please you enter mouth and days:\n"); printf("Mouth="); scanf("%d",&mouth); printf("Days="); scanf("%d",&days); switch(mouth) { case 1:s=0+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 2:s=31+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 3:s=59+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 4:s=90+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 5:s=120+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 6:s=151+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 7:s=181+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 8:s=212+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 9:s=243+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 10:s=273+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 11:s=304+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; case 12:s=334+days; printf("This is %d days of %d mouth in the %d year.\n",s,mouth,year); break; default: printf("error\n"); } } if(i==0) s=(s+7)%7; switch(s) { case 0:printf("This is Sunday.\n"); break; case 1:printf("This is Monday.\n"); break; case 2:printf("This is Tuesday.\n"); break; case 3:printf("This is Wednesday.\n"); break; case 4:printf("This is Thursday.\n"); break; case 5:printf("This is Friday.\n"); break; case 6:printf("This is Saturday.\n"); break; }
本文档为【[训练]判断平年还是闰年是这一年第多少天】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_260251
暂无简介~
格式:doc
大小:20KB
软件:Word
页数:6
分类:企业经营
上传时间:2017-08-31
浏览量:25