ITPub博客

首页 > 应用开发 > > ​谁能帮我看看哪里错了

​谁能帮我看看哪里错了

作者:lcc 时间:2019-10-17 15:56:21 0 删除 编辑

#include <stdio.h>

int main() 

{ 

    int year = 2008;

    int month =1;

    int day = 8;

    int date;

    switch(month)

    {

    case 1:date+=0;

    case 2:date+=31;

    case 3:date+=28;

    case 4:date+=31;

    case 5:date+=30;

    case 6:date+=31;

    case 7:date+=30;

    case 8:date+=31;

    case 9:date+=31;

    case 10:date+=30;

    case 11:date+=31;

    case 12:date+=day;

break;

    }

if(year%400==0||(year%4==0&&year%100!=00))

date=date+1+day;

    else

date=date+day;

    printf("%d年是%d月%d日是该年的第%d天 ",year,month,day,date);

return 0;

}

我输出的时候那个日期总是错误显示-837847982478一类的

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2331/viewspace-3136821/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-09-06

  • 博文量
    119
  • 访问量
    12367