| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 549 人关注过本帖
标题:【求助】这个代码问题出现在哪里啊
取消只看楼主 加入收藏
我国的驾
Rank: 2
等 级:论坛游民
帖 子:17
专家分:10
注 册:2012-11-25
结帖率:66.67%
收藏
 问题点数:0 回复次数:0 
【求助】这个代码问题出现在哪里啊
# include <stdio.h>

struct date
{
    int year;
    int month;
    int day;

};
days(day)
struct data day;
{
    static int day_tab[2][13]=
    {{0,31,28,31,30,31,30,31,31,30,31,30,31,},
    {0,31,29,31,30,31,30,31,31,30,31,30,31,},
    };
    int i,lp;
    lp=day.year%4==0&&day.year%100!=0||day.year%400==0;
    for (i=1;i<day.month;i++)
        day.day+=day_tab[lp][i];
    return(day.day);
}
int main(void)
{
    struct date today,term;
    int yearday,yearday,year,day;
    printf("Enter year/month/day:");
    scanf("%d%d%d",&today.year,&today.month,&today.day);
    term.month = 12;
    term.day = 31;
    for (yearday = 0 ,year = 1990;year<today.year;year++)
    {
        term.year = year;
        yearday+=days(term);
    }
    yearday+=days(term);
    day = yearday%5;
    if(day>0&&day<4)
        printf("He was fishing at that day.\n");
    else
        printf("He was sleeping at that day.\n");
    return 0;
}


搜索更多相关主题的帖子: Enter return include static 
2013-03-17 13:57
快速回复:【求助】这个代码问题出现在哪里啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041120 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved