标题:这个程序后半部分怎么不能执行呢??请高手指点啊
取消只看楼主
photon1001
Rank: 1
等 级:新手上路
帖 子:19
专家分:3
注 册:2010-9-10
结帖率:40%
 问题点数:0 回复次数:0 
这个程序后半部分怎么不能执行呢??请高手指点啊
/* Note:Your choice is C IDE */
#include "stdio.h"
void main()
{
    int days,days1,days2,n,i;
    int year1,year2,month1,month2,date1,date2;
    printf("请输入您的出生年月日:");
    scanf("%d",&year1);
    scanf("%d",&month1);
    scanf("%d",&date1);
    printf("请输入今天的年月日:");
    scanf("%d",&year2);
    scanf("%d",&month2);
    scanf("%d",&date2);
    for(n=year1,days=0;n<year2;n++)
    {
       if(((n%4==0)&&(n%100!=0))||(n%400==0))
       days=days+366;
       else
       days=days+365;
    }
    if(((year1%4==0)&&(year1%100!=0))||(year1%400==0))
       {
           for(i=1,days1=0;i<=12;i++)
        {
           if((i=1)||(i=3)||(i=5)||(i=7)||(i=8)||(i=10)||(i=12))
           days1=days1+31;
           else if((i=4)||(i=6)||(i=9)||(i=11))
           days1=days1+30;
           else
           days1=days1+28;
        }
       }
        else
        {
            for(i=1,days1=0;i<=12;i++)
        {
           if((i=1)||(i=3)||(i=5)||(i=7)||(i=8)||(i=10)||(i=12))
           days1=days1+31;
           else if((i=4)||(i=6)||(i=9)||(i=11))
           days1=days1+30;
           else
           days1=days1+27;
        }
        }
       if(((year2%4==0)&&(year2%100!=0))||(year2%400==0))
   {
           for(i=1,days2=0;i<=12;i++)
        {
           if((i=1)||(i=3)||(i=5)||(i=7)||(i=8)||(i=10)||(i=12))
           days2=days2+31;
           else if((i=4)||(i=6)||(i=9)||(i=11))
           days2=days2+30;
           else
           days2=days2+28;
        }
   }
        else
       {
            for(i=1,days2=0;i<=12;i++)
        {
           if((i=1)||(i=3)||(i=5)||(i=7)||(i=8)||(i=10)||(i=12))
           days2=days2+31;
           else if((i=4)||(i=6)||(i=9)||(i=11))
           days2=days2+30;
           else
           days2=days2+27;
        }
       }
      
   printf("今天是你人生的第%d天",days+days2-days1);
   return 0;


}
搜索更多相关主题的帖子: void 出生年月日 include choice 
2010-09-13 19:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-320321-1-1.html




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

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