首页 > 其他分享 >三天打鱼两天晒网

三天打鱼两天晒网

时间:2022-10-28 21:00:42浏览次数:41  
标签:case 两天晒网 三天打鱼 打渔 break printf 今日 else

#include<stdio.h>
#include<stdlib.h>
void main()
{
int a, b, c, d;
printf("输入年份:\n");
scanf("%d", &a);
getchar();
printf("输入月份:\n");
scanf("%d", &b);
getchar();
printf("输入日期:\n");
scanf("%d", &c);
getchar();

if (a / 4 != 0) //如果年份/4不等于0,那么不是闰年
{
if (b = 1)
{
d = c; //一月前没有月份天数

if (c<=31) //判断日期是否太大
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=32)//如果过大,输出数值过大提示
{
printf("日期太大\n");
}
}
///////////////////////一月代码结束///////////////

else if (b = 2)
{
d = 31 + c; //二月天数加一月总天数

if (c<=28)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=29)
{
printf("日期太大\n");
}
}
///////////////////////二月代码结束///////////////

else if (b = 3)
{
d = 59 + c; //前几个月的天数相加
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=32)
{
printf("日期太大\n");
}
}
///////////////////////三月代码结束///////////////

else if (b = 4)
{
d = 90 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=31)
{
printf("日期太大\n");
}
}
///////////////////////四月代码结束///////////////

else if (b = 5)
{
d = 120 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=32)
{
printf("日期太大\n");
}
}
///////////////////////五月代码结束///////////////

else if (b = 6)
{
d = 151 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=31)
{
printf("日期太大\n");
}
}
///////////////////////六月代码结束///////////////

else if (b = 7)
{
d = 181 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=32)
{
printf("日期太大\n");
}
}
///////////////////////七月代码结束///////////////

else if (b = 8)
{
d = 212 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c>=32)
{
printf("日期太大\n");
}
}
///////////////////////八月代码结束///////////////

else if (b = 9)
{
d = 243 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=31)
{
printf("日期太大\n");
}
}
///////////////////////九月代码结束///////////////

else if (b = 10)
{
d = 273 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=32)
{
printf("日期太大\n");
}
}
///////////////////////十月代码结束///////////////

else if (b = 11)
{
d = 304 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=31)
{
printf("日期太大\n");
}
}
///////////////////////十一月代码结束///////////////

else if (b = 12)
{
d = 334 + c;
if(c<=31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if(c>=32)
{
printf("日期太大\n");
}
}
else if(b>=13,b<=0)
{
printf("月份不符合规定");
}
}
///////////////////////非闰年代码结束///////////////

else //如果年份能被4整除,就是闰年
{
if (b = 1)
{
d = c; //一月前没有月份天数

if (c <= 31) //判断日期是否太大
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32) //如果过大,输出数值过大提示
{
printf("日期太大\n");
}
}
///////////////////////一月代码结束///////////////

else if (b = 2)
{
d = 31 + c; //二月天数加一月总天数

if (c <= 28)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 29)
{
printf("日期太大\n");
}
}
///////////////////////二月代码结束///////////////

else if (b = 3)
{
d = 59 + c; //前几个月的天数相加
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32)
{
printf("日期太大\n");
}
}
///////////////////////三月代码结束///////////////

else if (b = 4)
{
d = 90 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 31)
{
printf("日期太大\n");
}
}
///////////////////////四月代码结束///////////////

else if (b = 5)
{
d = 120 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32)
{
printf("日期太大\n");
}
}
///////////////////////五月代码结束///////////////

else if (b = 6)
{
d = 151 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 31)
{
printf("日期太大\n");
}
}
///////////////////////六月代码结束///////////////

else if (b = 7)
{
d = 181 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32)
{
printf("日期太大\n");
}
}
///////////////////////七月代码结束///////////////

else if (b = 8)
{
d = 212 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32)
{
printf("日期太大\n");
}
}
///////////////////////八月代码结束///////////////

else if (b = 9)
{
d = 243 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 31)
{
printf("日期太大\n");
}
}
///////////////////////九月代码结束///////////////

else if (b = 10)
{
d = 273 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32)
{
printf("日期太大\n");
}
}
///////////////////////十月代码结束///////////////

else if (b = 11)
{
d = 304 + c;
if (c <= 30)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 31)
{
printf("日期太大\n");
}
}
///////////////////////十一月代码结束///////////////

else if (b = 12)
{
d = 334 + c;
if (c <= 31)
{
switch (d % 5)
{
case 1:printf("今日打渔\n"); break;
case 2:printf("今日打渔\n"); break;
case 3:printf("今日打渔\n"); break;
case 4:printf("今日晒网\n"); break;
case 0:printf("今日晒网\n"); break;
}
}
else if (c >= 32)
{
printf("日期太大\n");
}
}
else if (b >= 13, b <= 0)
{
printf("月份不符合规定");
}
}
///////////////////////非闰年代码结束///////////////
}

标签:case,两天晒网,三天打鱼,打渔,break,printf,今日,else
From: https://www.cnblogs.com/piyuheng/p/16837471.html

相关文章