| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 358 人关注过本帖
标题:求高手帮忙纠错 nextday问题
只看楼主 加入收藏
时间流走记忆
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-11-4
结帖率:0
收藏
已结贴  问题点数:10 回复次数:2 
求高手帮忙纠错 nextday问题
#include <stdio.h>
#include <stdlib.h>

int n,flag;
int find(int x,int c[n])
{
    int i;
    for(i=0;i<n;i++)
    {
                    if(x==c[i])
                    break;
                    else
                    flag=0;
                    }
                    flag=1;
                    return flag;
    }
   
int main()
{
    int day,month,year,nextday,nextmonth,nextyear;
    int a[6]={1,3,5,7,8,10},b[4]={4,6,9,11};
    printf("输入今天的日子,以dd,mm,yy的格式:");
    scanf("%d%d%d",&day,&month,&year);
    printf("\n");
    while(1)
    {
            if(day>31||month>12)
            printf("输入有误,重新输入:");
            scanf("%d%d%d",&day,&month,&year);
            }                                        //输入
            
            find(month,a[6]); [Warning] passing arg 2 of `find' makes pointer from integer without a cast   
             if(flag==1)                              //month属于a[6]
            {
                                                     if(day<30) nextday=day+1;
                                                     if(day=31)
                                                     {
                                                                nextday=1;nextmonth=month+1;
                                                                }
                                                     }
                                                     else if(month,b[4])
                                                     {
                                                          if(day<29) nextday=day+1;
                                                          if(day=30)
                                                          {
                                                                nextday=1;nextmonth=month+1;
                                                                }
                                                          }
                                                          else if(month==12)
                                                          {
                                                               if(day<31) nextday=day+1;
                                                               else
                                                               {
                                                                   nextday=1;nextmonth=month+1;nextyear=year+1;
                                                                   }
                                                               }
                                                               else
                                                               {
                                                                   if((year%4==0&&year%400!=0)||year%400==0)
                                                                   printf("%d is a leap year.",year);
                                                                   {
                                                                              if(day<29) nextday=day+1;
                                                                              else
                                                                              {
                                                                                   nextday=1;nextmonth=month+1;
                                                                                   }
                                                                              }
                                                                              else    说这句话有syntax error,是怎么错了
                                                                              {
                                                                                  if(day<28) nextday=day+1;
                                                                                  else
                                                                                  {
                                                                                   nextday=1;nextmonth=month+1;
                                                                                   }
                                                                                  }
                                                                              
                                                                   } before这个‘}’也有句法错误???
                                    printf("NEXTDAY IS %d %d %d."nextday,nextmonth,nextyear) 说这句话有问题如下:a parameter list with an ellipsis can't match an empty parameter name list declaration                                                                     
  return 0;
}

搜索更多相关主题的帖子: 今天 include return 
2012-11-04 14:10
w527705090
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:441
专家分:1882
注 册:2011-6-28
收藏
得分:10 
纠错我就不纠错了 ,首先我要告诉你 ,这是肯定有错误的 ,但是系统所指出的错误有些是错误的 ,所以也需要你的判断力去解决   又是后你把你的错误改正了之后 ,那些系统提示的假错误也就消失了,。。。。

有心者,千方百计;无心者,千难万难。
2012-11-04 15:21
时间流走记忆
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-11-4
收藏
得分:0 
回复 2楼 w527705090
谢谢哦,我也在找错,不过应该是对C的基础认识上错了,因为很多都是说syntax error,我又不知道错在哪了
2012-11-04 15:23
快速回复:求高手帮忙纠错 nextday问题
数据加载中...
 
   



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

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